Torrone has quit [Quit: This computer has gone to sleep]
kobain has joined #ruby
xall has quit [Ping timeout: 240 seconds]
n90b0jjf has quit [Ping timeout: 240 seconds]
n90b0jjf has joined #ruby
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
A_Drone has joined #ruby
wolffles has quit [Quit: wolffles]
tmtwd has joined #ruby
ur5us has quit [Remote host closed the connection]
freerobby has quit [Quit: Leaving.]
sp_ has quit [Ping timeout: 265 seconds]
freerobby has joined #ruby
xxneolithicxx has joined #ruby
Bounga has quit [Ping timeout: 260 seconds]
davedev24 has quit []
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jud^ has joined #ruby
Cohedrin has joined #ruby
A_Drone has quit [Read error: Connection reset by peer]
jud has quit [Ping timeout: 252 seconds]
macsteps has quit [Remote host closed the connection]
zacts has quit [Read error: Connection reset by peer]
xall has joined #ruby
A_Drone has joined #ruby
ICantCook has joined #ruby
nando293921 has quit [Ping timeout: 260 seconds]
hahuang65 has joined #ruby
kobain has quit [Ping timeout: 260 seconds]
tmtwd has quit [Ping timeout: 264 seconds]
xxneolithicxx has quit [Quit: Leaving.]
astrobun_ has joined #ruby
A_Drone has quit [Remote host closed the connection]
hahuang65 has quit [Ping timeout: 250 seconds]
impermanence has joined #ruby
ur5us has joined #ruby
kobain has joined #ruby
JoshGlzBrk has joined #ruby
LoneHerm_ has joined #ruby
JeanCarl1Machado has quit [Quit: Lost terminal]
Hyuk has joined #ruby
harfangk has joined #ruby
Rodya_ has quit [Remote host closed the connection]
memorasus has quit [Ping timeout: 250 seconds]
arescorpio has joined #ruby
Torrone has joined #ruby
dcunit3d has quit [Ping timeout: 258 seconds]
n90b0jjf has quit [Remote host closed the connection]
ThinTim has joined #ruby
hiptobecubic_ has joined #ruby
ThinTim has quit [Client Quit]
poguez_ has quit [Quit: Connection closed for inactivity]
<hiptobecubic_>
Hey everyone. I have no idea what I'm doing. I just did `bundle install --path vendor/bundle` as it suggested, but now I'm not sure how to tell ruby to look there when running an application
<hiptobecubic_>
And this works differently from python's hermetic approach it seems
macsteps has joined #ruby
TPug has joined #ruby
A_Drone has joined #ruby
eljimmy has joined #ruby
the_rhizo has quit [Ping timeout: 265 seconds]
Izabia has joined #ruby
TPug has quit [Ping timeout: 258 seconds]
Izabia has quit [Max SendQ exceeded]
<hiptobecubic_>
sigh
Rodya_ has joined #ruby
<matthewd>
hiptobecubic_: Does sigh mean you've worked it out?
<hiptobecubic_>
No :)
<hiptobecubic_>
I tried a few things
<hiptobecubic_>
is "bundle exec ruby app.rb" reasonable looking?
<hiptobecubic_>
it looks like maybe it worked, but I don't actually what the semantics of that are
OTORelic2 has joined #ruby
Rodya_ has quit [Remote host closed the connection]
<matthewd>
Sounds likely
Derperperd has quit [Quit: Derperperd]
<matthewd>
Though I guess my first question would be if you don't have a specific understood requirement, why are you using a non-default option at all?
<matthewd>
What is the 'it' that suggested --path ?
<hiptobecubic_>
bundle install
<hiptobecubic_>
"you don't have permission to .... why not use --path vendor/bundle" ?
<hiptobecubic_>
<paraphrasing but that was essentially he message>
minimalism has joined #ruby
OTORelic1 has quit [Ping timeout: 264 seconds]
A_Drone has quit [Ping timeout: 240 seconds]
astrobun_ has quit [Remote host closed the connection]
astrobun_ has joined #ruby
A_Drone has joined #ruby
Derperperd has joined #ruby
<matthewd>
Ah, okay. I think I forgot it doesn't just default to --user-install where necessary.
<matthewd>
Anyway, yes: run things with bundle exec.
claw has quit [Read error: Connection reset by peer]
Ropeney has joined #ruby
claw has joined #ruby
iMadper has joined #ruby
sp_ has joined #ruby
ruisanto1 has quit [Remote host closed the connection]
astrobun_ has quit [Remote host closed the connection]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
OTORelic2 has quit [Ping timeout: 276 seconds]
xlegoman has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sp_ has quit [Ping timeout: 258 seconds]
govg has quit [Ping timeout: 240 seconds]
LoneHerm_ has quit [Remote host closed the connection]
Bounga has quit [Remote host closed the connection]
<soLucien>
how do i do it ?
<soLucien>
of course, this is not correct
Bounga has joined #ruby
<soLucien>
but what would be the appropriate ruby synthax for this ?
<soLucien>
i feel that I am really close
<Zarthus>
it being 10 in the morning does not help, but I'm not sure what you mean
<Zarthus>
what's wrong with your existing code?
memorasus has joined #ruby
<Zarthus>
aside from possibly editing the same hash in a loop
<soLucien>
idk it does not lint
<soLucien>
unexpected tIDENTIFIER
platzhir1 has joined #ruby
yfeldblum has joined #ruby
<Zarthus>
You'll need to provide full code and full error message then
<Zarthus>
although I still think you probably want to use better variable names and/or not edit 'a' mid loop
<soLucien>
tuplet
<hanmac>
soLucien: your problem is that you miss the ";" inside the block ...
<hanmac>
and imo you use map wrong
<Zarthus>
hanmac: if that wasn't merged together for display on IRC I fear there's more problems with that code than just a missing ; :P
<hanmac>
that what i would probably do: hv_options.map{|a| { 'mac_address' => a['MacAddress'].scan(/([A-F0-9]{2})/).join(':'), 'name' => a['SwitchName'] }
<soLucien>
hanmac Zarthus the map thing i was trying to do was in order to reuse the same variable
<soLucien>
i was thinking of map! as well in this situation
<Zarthus>
you don't have indentation in your code?
<soLucien>
but i have only been doing Ruby for about a week, so help me out here
<Zarthus>
options has to be a hash
<soLucien>
i do .. i ctrl-deleted it in this gist
<Zarthus>
other than that it looks OK to me
<jhass>
why?!
<soLucien>
because it was 10 lines indented
<soLucien>
why what ?
Sammichmaker has joined #ruby
<jhass>
well that's not good by itself
<jhass>
but why remove the relative indentation too
<jhass>
so, how does a map "reuse the same variable" but each doesn't?
<soLucien>
ah indentation .. well it's in the middle of the code
<soLucien>
jhass help me do it better
A_Drone has joined #ruby
<jhass>
you should review the difference between array and hash
<soLucien>
really .. in powershell it's $var | $_.mac_address=$_.MacAddress
<soLucien>
i know the difference mate
<soLucien>
it's not a hash
<jhass>
nope, you don't
<jhass>
"['SwitchName'='your-interface-name','MacAddress'='1234567890ab']" is just nothing, not an array, not hash
A_Drone has quit [Remote host closed the connection]
<soLucien>
i wrote it off the top of my head
<soLucien>
to serve as an example
<jhass>
doesn't make it any more right
<jhass>
having these concepts crystal clear at any point is quite important
<jhass>
they're at the core of doing data processing with ruby
Xeago_ has joined #ruby
ferr has joined #ruby
vondruch has joined #ruby
A_Drone has joined #ruby
<soLucien>
updated for you jhass
Xeago has quit [Ping timeout: 258 seconds]
Xeago_ is now known as Xeago
matp has quit [Remote host closed the connection]
<jhass>
you want an (I have to guess!) array of hashes in return, knowing the ruby presentation of that is important
tomphp has joined #ruby
memorasus has quit [Ping timeout: 250 seconds]
<soLucien>
updated yet again.
<soLucien>
now .. what's the best way of doign thsi ?
<soLucien>
this
dionysus69 has quit [Quit: dionysus69]
<jhass>
you "I want this" still isn't valid Ruby (well it is, but it doesn't make much sense and isn't what you want)
<soLucien>
i want to 1 ) iterate through it , change both keys and values of the hash 2) end up with no extra objects
antgel has joined #ruby
<soLucien>
so no options object would be prefferable
<soLucien>
is that possible using anything from the stdlib ?
<jhass>
Ruby is pass by reference, seems easy enough
<jhass>
you would use Array#each
<jhass>
perhaps Hash#delete
impermanence has joined #ruby
<soLucien>
i know how to do it in 6 other programming languages, not yet in Ruby :)
<soLucien>
ok, i'll change to use each and delete
<hanmac>
soLucien: why not like i said before? hv_options.map{|a| { 'mac_address' => a['MacAddress'].scan(/([A-F0-9]{2})/).join(':'), 'name' => a['SwitchName'] }
A_Drone has quit [Remote host closed the connection]
<hanmac>
it returns a new array with new hashs ... imo the most clean way for that
<zenspider>
deleting over the data structure you're enumerating is a Bad Idea™ in nearly every language I've ever coded in
<soLucien>
yes and it throws exceptions in c#/Java
<jhass>
zenspider: they're iterating over an outer array, not the hash I suggested to delete from
lightheaded has quit []
impermanence has quit [Ping timeout: 258 seconds]
<zenspider>
soLucien: as it should
der-landgraf has quit [Ping timeout: 252 seconds]
A_Drone has joined #ruby
djbkd has quit [Remote host closed the connection]
govg has joined #ruby
senayar has joined #ruby
ericsupreme has joined #ruby
djbkd has joined #ruby
OTORelic2 has joined #ruby
karapetyan has joined #ruby
djbkd has quit [Client Quit]
jaruga___ has joined #ruby
jaruga___ is now known as jaruga____
marr has joined #ruby
PickAndMix has quit [Quit: WeeChat 1.4]
govg has quit [Ping timeout: 258 seconds]
n90b0jjf has joined #ruby
<zenspider>
map! seems obvious... but I also think OP needs to learn the difference between arrays and hashes (and there are no real tuples in ruby either). *shrug*
OTORelic2 has quit [Ping timeout: 258 seconds]
ur5us has joined #ruby
postmodern has quit [Quit: Leaving]
karapetyan has quit [Ping timeout: 276 seconds]
jackjackdripper has quit [Quit: Leaving.]
max1 has joined #ruby
<soLucien>
i have fixed it and yes i have used map!
<soLucien>
i know the difference between an array and hash. What i lack is experience in Ruby.
n90b0jjf has quit [Ping timeout: 240 seconds]
max1 is now known as PickAndMix
ericsupreme has quit [Quit: Leaving]
bookies has joined #ruby
hahuang65 has joined #ruby
dunpeal has joined #ruby
Torrone has joined #ruby
bluOxigen has joined #ruby
<bookies>
How can I get the rate of CHF in this JSON? (https://bitpay.com/api/rates)? I tried something like JSON.parse(website.body)["GBP"]["rate"].to_f and some other ways but I can't understand how its format works
govg has joined #ruby
<zenspider>
bookies: that looks like an array of hashes, not a hash of hashes, so your first access on it is broken
hahuang65 has quit [Ping timeout: 250 seconds]
dunpeal has quit [Ping timeout: 265 seconds]
<bookies>
zenspider: how do I handle an array of hashes? Can I be calling like that (somehow) to get these rates?
<bookies>
I tried the [1] and [5], etc and I just get characters
hahuang65 has joined #ruby
<zenspider>
you'll have to look through the array for the hash that meets your needs
<fergal>
hi guys, currently i am able to test that a method throws an exception by checking for the exception message like: `expect(logger).to receive(:warn).with(/has invalid syntax/)` - the thing is, there are two different exception types that throw this message, how can i test that a specific exception type has been thrown?
<zenspider>
fergal: you're testing that a logger gets some text... not that a method throws an exception... why not test that the method throws an exception?
<jhass>
mh, I guess if it doesn't bubble up to your spec you can't
The_Phoenix1 has joined #ruby
The_Phoenix has quit [Ping timeout: 260 seconds]
ntt has quit [Ping timeout: 260 seconds]
Bounga has quit [Ping timeout: 265 seconds]
<fergal>
zenspider: do you have any links to resources that show how to do that?
<jhass>
I guess you could do something like expect(ArgumentError).to receive(:new) or even expect(foo).to receive(:raise).with(ArgumentError) ...
n90b0jjf has quit [Ping timeout: 240 seconds]
<jhass>
but even if that works... meh
<zenspider>
in minitest it is assert_raises(XType) do ... end
<jhass>
fergal: assuming it _does_ bubble up to your spec ^
<zenspider>
in minitest/spec it is lambda { ... }.must_raise XType
<jhass>
expect_raises(ArgumentError) do end in rspec
<zenspider>
there's probably somethnig similar
<fergal>
jhass: well my method catches the exception, then logs a message and the program proceeds as normal
<zenspider>
expect_raises? haha! that sure looks like an assertion
tomphp has quit [Read error: Connection reset by peer]
<jhass>
fergal: guessed so, hence my earlier comments
<zenspider>
fergal: sounds like you're either testing at the wrong level or your method does too much
tomphp has joined #ruby
<dminuoso>
fergal: How about you just raise the specific error with allow(obj).to receive(:trigger).and_raise(ArgumentError, "foo")
astrobun_ has quit [Remote host closed the connection]
<dminuoso>
If that's what you are trying to test for.
<dminuoso>
Test behavior, not your inner workings.
yeticry has quit [Ping timeout: 244 seconds]
xall has joined #ruby
TomyWork has joined #ruby
<fergal>
zenspider: well this method just parses a file, and if parsing is successful, returns true. if there are errors in the file, it raises some exceptions, which log certain messages
<fergal>
thanks for the help guys, i’ll try out these suggestions :)
yeticry has joined #ruby
Ishido has joined #ruby
anisha_ has joined #ruby
<zenspider>
fergal: one method tries to parse & return true, or raises. another method calls that method, rescues and logs. now testing is easy
anisha has quit [Ping timeout: 244 seconds]
<soLucien>
i have a self.method. i want to create some helper methods in this class .
<soLucien>
should they also be called as self.stuff ?
<soLucien>
because it seems that i cannot access instance methods
<jhass>
well, think about it, which instance would they be called on?
<soLucien>
none. So what can i do ?
<soLucien>
declare them all as self ?
<jhass>
yes
<soLucien>
how about calling them ? also need to use self ?
<zenspider>
soLucien: you're ALWAYS in a "self" context. it just matters what self is at the time. what you're describing is a class method, so self is the class.
<zenspider>
in an instance method, self is the instance
<soLucien>
alright, that means no , i don;t need to specify it
<dminuoso>
soLucien: "def self.method" is the only weird thing, since it's very special syntax sugar.
<soLucien>
because it's the same context
flyingX has joined #ruby
<soLucien>
how about class variables ? Is this ok ?
joonty has quit [Quit: This computer has gone to sleep]
hahuang65 has joined #ruby
n90b0jjf has joined #ruby
craigp_ has quit [Ping timeout: 276 seconds]
LoneHermit has joined #ruby
n90b0jjf has quit [Ping timeout: 240 seconds]
hahuang65 has quit [Ping timeout: 250 seconds]
<jhass>
irc_BT: so?
dionysus69 has quit [Ping timeout: 276 seconds]
LoneHermit has quit [Ping timeout: 252 seconds]
fergal_ has joined #ruby
tvw has quit [Read error: Connection reset by peer]
tvw has joined #ruby
beilabs_ has joined #ruby
fergal has quit [Ping timeout: 252 seconds]
fergal_ is now known as fergal
n90b0jjf has joined #ruby
AzureStigma has joined #ruby
beilabs has quit [Ping timeout: 244 seconds]
AzureStigma has quit [Client Quit]
leea has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
n90b0jjf has quit [Ping timeout: 240 seconds]
freerobby has joined #ruby
freerobby1 has joined #ruby
freerobby has quit [Read error: Connection reset by peer]
ChoiKyuSang has quit [Quit: See ya!]
rodfersou has joined #ruby
govg has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
craigp_ has joined #ruby
xall has quit [Ping timeout: 258 seconds]
n90b0jjf has joined #ruby
matp has joined #ruby
kavanagh has joined #ruby
dcunit3d has quit [Ping timeout: 252 seconds]
A_Drone has quit [Ping timeout: 250 seconds]
Bounga has quit [Ping timeout: 244 seconds]
joonty has joined #ruby
n90b0jjf has quit [Ping timeout: 240 seconds]
dsea has quit [Ping timeout: 244 seconds]
Madplatypus has quit [Quit: Connection closed for inactivity]
rodfersou has quit [Ping timeout: 264 seconds]
A_Drone has joined #ruby
A_Drone has quit [Remote host closed the connection]
rodfersou has joined #ruby
devec0 has quit [Ping timeout: 250 seconds]
joonty has quit [Quit: This computer has gone to sleep]
OTORelic2 has joined #ruby
n90b0jjf has joined #ruby
rileyy has joined #ruby
beilabs_ has quit [Remote host closed the connection]
mrmortondk has joined #ruby
andikr has joined #ruby
OTORelic2 has quit [Ping timeout: 258 seconds]
rileyy has quit [Remote host closed the connection]
Nahra has quit [Read error: Connection reset by peer]
Parko has quit [Quit: In a while, crocodile]
Nahra has joined #ruby
Torrone has quit [Quit: This computer has gone to sleep]
n90b0jjf has quit [Ping timeout: 240 seconds]
dunpeal has joined #ruby
Torrone has joined #ruby
n90b0jjf has joined #ruby
vuoto has joined #ruby
Hyuk has joined #ruby
hahuang65 has joined #ruby
<fergal>
hi guys, i am trying to test a method that calls YAML.load_file to parse this yaml file: https://gist.github.com/anonymous/a53685dfc092de2a7e87b0952b54f065 this yaml should cause the YAML.load_file to throw a SyntaxError. in my test, i am trying to hardcode the broken yaml file, then mock the call to the method that calls YAML.load_file so that the broken hash is returned, but i can’t seem to get it working - or rather, the broken yaml always causes a type err
<fergal>
rather than a syntax error. are there any examples online of testing against malformed file contents?
<dminuoso>
fergal: Show us some code.
GodFather has joined #ruby
<dminuoso>
expect { Parser.parse(broken_hash) }.to raise_error(SyntaxError) seems fairly straight forward, so Id like to see what exactly you are doing in your tests.
n90b0jjf has quit [Ping timeout: 240 seconds]
LoneHerm_ has joined #ruby
GodFather has quit [Read error: Connection reset by peer]
jgt has quit [Quit: WeeChat 1.4]
hahuang65 has quit [Ping timeout: 250 seconds]
vuoto has quit [Remote host closed the connection]
jgt has joined #ruby
vuoto has joined #ruby
GodFather has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
Hyuk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
alfiemax has quit [Ping timeout: 250 seconds]
Hyuk has joined #ruby
Hyuk has quit [Client Quit]
chriscoffee has joined #ruby
Hyuk has joined #ruby
vuoto has quit [Remote host closed the connection]
umdstu has joined #ruby
n90b0jjf has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
<jhass>
"throws a ... and continues" seems to contradict itself
reisei has joined #ruby
<reisei>
hi, all!
<reisei>
Is there a way to check indents in text file?
<tobiasvl>
reisei: check how?
tvw has quit [Ping timeout: 244 seconds]
<reisei>
tobiasvl: count indents of each line in txt file I guess.
<tobiasvl>
OK, what's an indent then? is one indent == 4 spaces? if so you can easily just count them?
<tobiasvl>
not aware of a gem that does it for you but should be easy enough to make yourself
PickAndMix has quit [Quit: WeeChat 1.4]
tyang has joined #ruby
mim1k has joined #ruby
kobain has joined #ruby
<reisei>
tobiasvl: well, that's what I'm interesting in :) I'm just starting to learn ruby. I try to google how to count it, but somehow didn't find any usefull methods
<reisei>
tobiasvl: can you point me articles or anything about it?
conta has quit [Remote host closed the connection]
<tobiasvl>
well, where are you stuck? I could just link you to articles about IO in ruby but I'm not sure that's what you want
A_Drone has joined #ruby
<reisei>
I don't understand how to get number of spaces in the beginning of line ( i think that's how I get the indents)
GodFather has quit [Quit: Ex-Chat]
<canton7>
reisei, have you figured out how to get each line in a file?
GodFather has joined #ruby
last_staff has quit [Quit: last_staff]
<reisei>
canton7: yes, I think so, with cycle and `line`
byteflame has joined #ruby
pawnbox has quit [Remote host closed the connection]
<canton7>
reisei, ok, do you know how to get each character in a string?
pawnbox has joined #ruby
mim1k has quit [Ping timeout: 276 seconds]
A_Drone has quit [Ping timeout: 265 seconds]
synthroi_ has joined #ruby
<reisei>
canton7: theoretically string is an aray, so I can check all its values.
synthroi_ has quit [Remote host closed the connection]
<canton7>
well, not really, but there's a method to iterate over the characters in a string. Look on the doc page for String
<canton7>
but anyway. So you know how to get each character in each line. Do you know how to test if a character is equal to a space?
OTORelic2 has joined #ruby
flashpoint9 has joined #ruby
synthroid has quit [Ping timeout: 264 seconds]
<reisei>
canton7: yes, sure, but I don't need any character I just need the first characters.
dionysus69 has quit [Remote host closed the connection]
<jhass>
look up the break keyword or Enumerable#take_while
<tobiasvl>
(you can use regex too…)
<tobiasvl>
the filthy word
<canton7>
reisei, ok, but look through the characters one by one, starting at the beginning of the line, and keep going until you reach something that isn't an indentation character
<canton7>
tobiasvl, he can't write this using simple loops. I doubt he can handle the regex :P
<tobiasvl>
hehe
mradmacher has joined #ruby
<canton7>
reisei, do it using pencil and paper, and see how you do it. You start at the first character on a line, and you count the number of spaces until you reach actual text
<canton7>
now you need to tell the computer to do the same thing
synthroid has joined #ruby
OTORelic2 has quit [Ping timeout: 260 seconds]
<reisei>
Thanks everyone!
synthroi_ has joined #ruby
eizua has joined #ruby
A_Drone has joined #ruby
mim1k has joined #ruby
joonty has joined #ruby
karapety_ has joined #ruby
<reisei>
canton7: you know how to teach properly :)
<canton7>
you get a lot of practice on IRC :P
conta has joined #ruby
<reisei>
IRC is my last resort
<rubirc>
hey guys, when I do an ffi call into a function and that function blocks for some reason (doesn't immediately return back to the program) and I try to stop the ruby program with ctrl+c, it will wait until the function returns
<rubirc>
is there a solution for this?
theery has joined #ruby
giz|work has quit [Ping timeout: 250 seconds]
<jhass>
mmh, any function call at all, tried something stupid simple like sleep(3)?
AzureStigma has joined #ruby
<jhass>
just to check that the function you call doesn't mask signals (intentionally)
dionysus69 has joined #ruby
jmignault has joined #ruby
synthroid has quit [Ping timeout: 260 seconds]
karapetyan has quit [Ping timeout: 258 seconds]
xall has joined #ruby
A_Drone has quit [Ping timeout: 276 seconds]
theery has quit [Client Quit]
ramortegui has joined #ruby
blackgoat has quit [Quit: WeeChat 1.5]
theery has joined #ruby
xlegoman has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
karapety_ has quit [Remote host closed the connection]
mradmacher has quit [Quit: WeeChat 1.4]
GodFather has quit [Ping timeout: 240 seconds]
antgel has quit [Ping timeout: 260 seconds]
karapetyan has joined #ruby
hahuang65 has joined #ruby
karapetyan has quit [Read error: Connection reset by peer]
xall has quit [Ping timeout: 265 seconds]
dminuoso has quit [Ping timeout: 276 seconds]
karapetyan has joined #ruby
karapetyan has quit [Read error: Connection reset by peer]
antgel has joined #ruby
hahuang65 has quit [Ping timeout: 250 seconds]
beilabs has quit [Read error: Connection reset by peer]
xall has joined #ruby
govg has joined #ruby
karapetyan has joined #ruby
beilabs has joined #ruby
sp_ has quit [Quit: leaving]
ruby-lang710 has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
karapetyan has quit [Remote host closed the connection]
xall has quit [Ping timeout: 276 seconds]
karapetyan has joined #ruby
ChiefAlexander has joined #ruby
dminuoso has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
karapetyan has quit [Read error: Connection reset by peer]
karapetyan has joined #ruby
GodFather has joined #ruby
irc_BT is now known as rubynewbie
harfangk has joined #ruby
jaiks has quit [Ping timeout: 250 seconds]
karapetyan has quit [Remote host closed the connection]
<ruby-lang710>
Hello I want to make a local intercepting proxy (or something like it) witch will change the body of the response, but I have problems with HTTPS, what should I use?
karapetyan has joined #ruby
LastWhisper____ has joined #ruby
LastWhisper____ has quit [Read error: Connection reset by peer]
<dminuoso>
ruby-lang710: Ignore TLS, let some other part handle it.
pawnbox has quit [Remote host closed the connection]
<dminuoso>
ruby-lang710: Every http server in Ruby completely forgoes TLS, assuing you have some reverse proxy handling TLS termination (e.g. a local nginx)
pawnbox has joined #ruby
cibs has joined #ruby
submitnine has quit [Ping timeout: 276 seconds]
<dminuoso>
ruby-lang710: For othe other, make sure you look at Rack (its perfect for your task)
aegis3121 has joined #ruby
karapetyan has quit [Remote host closed the connection]
<jhass>
I think puma can handle it actually
<workmad3>
jhass: was about to say taht :)
<jhass>
and I vaguely remember thin too?
<workmad3>
*that
dminuoso has quit [Remote host closed the connection]
jaiks has joined #ruby
karapetyan has joined #ruby
karapetyan has quit [Read error: Connection reset by peer]
ta_ has quit [Remote host closed the connection]
malconis has joined #ruby
alfiemax has joined #ruby
n90b0jjf has joined #ruby
DanyC has joined #ruby
karapetyan has joined #ruby
soLucien has joined #ruby
hutch34 has joined #ruby
jmignault has quit [Ping timeout: 250 seconds]
karapetyan has quit [Read error: Connection reset by peer]
<ruby-lang710>
dminuoso: So my app should connect to reverse proxy add that proxy have to deal with encryption/decryption between itself and the final destination?
<soLucien>
is "monkey patching" possible in Ruby ?
<MaraJade>
Question: Are http connections disabled by default in ruby? Is there some setting I need to put in to turn them on? Or is this a project specific thing?
Pupeno has quit [Read error: Connection reset by peer]
SilverKey has quit [Quit: Halted.]
MaraJade has left #ruby [#ruby]
last_staff has joined #ruby
tomphp has joined #ruby
<smathy>
Also, FWIW, in the example c_nick asked about ( /\d+(?:\.\d+)/ ) the grouping serves no purpose at all.
<apeiros>
hurray for pointless noise in regexen :D
devec0 has joined #ruby
<jhass>
we should add pointless noses instead
<apeiros>
POINTLESS NOSES UNTO THE NOSE GODS!
<jhass>
(?:-)*+
hahuang65 has quit [Ping timeout: 250 seconds]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
JakFrist has joined #ruby
SilverKey has joined #ruby
ftj has joined #ruby
dcunit3d has joined #ruby
A_Drone has joined #ruby
SilverKey has quit [Client Quit]
<apeiros>
(?:[\u002d])*+
karapetyan has quit [Remote host closed the connection]
dumdedum has quit [Quit: foo]
malconis has joined #ruby
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
enodata has joined #ruby
wrkrcoop has joined #ruby
<wrkrcoop>
so i have an API where i call a class that deletes a message from a queue if it was successful. Instead of creating a new instance of the class I made all the methods class methods and store some immutable state in class variables. does this sound ok … ?
memorasus has quit [Remote host closed the connection]
memorasus has joined #ruby
conta has joined #ruby
deimos has quit [Changing host]
deimos has joined #ruby
davic has quit [Changing host]
davic has joined #ruby
ELLIOTTCABLE has quit [Changing host]
ELLIOTTCABLE has joined #ruby
nadir has quit [Changing host]
nadir has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
zacstewart has joined #ruby
cdg has quit [Ping timeout: 250 seconds]
Vingador has quit [Ping timeout: 244 seconds]
deniskozlov has quit [Quit: Konversation terminated!]
djbkd has joined #ruby
ptierno has joined #ruby
yfeldblum has joined #ruby
flashpoint9 has joined #ruby
iLogic has quit [Ping timeout: 240 seconds]
AndrewIs_ has joined #ruby
AndrewIsHere has quit [Read error: Connection reset by peer]
iLogic has joined #ruby
perlgod has joined #ruby
sepp2k has quit [Quit: Leaving.]
AndrewIsHere has joined #ruby
AndrewIs_ has quit [Read error: Connection reset by peer]
Torrone has quit [Quit: This computer has gone to sleep]
patrick-sartent has joined #ruby
eljimmy has quit [Quit: This computer has gone to sleep]
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
macsteps has quit [Remote host closed the connection]
tomphp has joined #ruby
iLogic has left #ruby [#ruby]
solars has quit [Ping timeout: 265 seconds]
vuoto has joined #ruby
vuoto has quit [Remote host closed the connection]
karapetyan has joined #ruby
vuoto has joined #ruby
SilverKey has joined #ruby
zarubin has joined #ruby
DanyC has left #ruby [#ruby]
jenrzzz_ has quit [Ping timeout: 258 seconds]
minimalism has joined #ruby
zarubin has quit [Client Quit]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
dionysus69 has joined #ruby
hahuang65 has joined #ruby
clandry94 has joined #ruby
ramfjord has joined #ruby
<clandry94>
Hi all, question regarding the behavior of hashes. Referring a hash key (which exists), but has a value of nil. If I call that key, then nil should be returned, correct?
karapetyan has quit [Ping timeout: 276 seconds]
Uranio has joined #ruby
Uranio has quit [Client Quit]
mikecmpbll has quit [Quit: inabit. zz.]
mikecmpbll has joined #ruby
<jhass>
yes
ta_ has quit [Ping timeout: 244 seconds]
hahuang65 has quit [Ping timeout: 276 seconds]
tfitts has quit [Quit: Connection closed for inactivity]
ta_ has joined #ruby
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
conta has quit [Ping timeout: 264 seconds]
solars has joined #ruby
QORRiE has joined #ruby
tomphp has joined #ruby
blackmesa has joined #ruby
Es0teric has quit [Quit: Computer has gone to sleep.]
flashpoint9 has quit [Remote host closed the connection]
dcunit3d has quit [Ping timeout: 264 seconds]
sepp2k has joined #ruby
tyang has quit [Ping timeout: 250 seconds]
<clandry94>
@jhass Okay, I was experimenting a bit and came across a weird issue. Suppose there is a hash named 'foo' with a few keys. I then use #each on foo.keys to iterate over each of the keys yielding to |key|. Inside of the loop I have a case statement and one of those when statements is foo[key].nil?. When that when statement is called, foo[key].nil? is never true even when foo[key] is definitely true
<clandry94>
@jhass will send a snippet
mweshi has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
mikecmpbll has joined #ruby
<nofxx>
clandry94, hsh.keys { |x| next if x.nil?
<nofxx>
if you do have a nil key there il'll work
<nofxx>
clandry94, have in mind nil: 'foo' =! nil => 'foo'
<nofxx>
first is a symbol
<clandry94>
@nofxx Yes, I've considered that. Trying to create a test case to send
<zenspider>
siaw23: why? what's wrong with it? what are you hoping to remove?
Psi-Jack_ is now known as Psi-Jack
<nitric>
siaw23: you could do "fh.write <<~EOS", the so-called "squiggly heredoc"
arashb has joined #ruby
arashb has quit [Remote host closed the connection]
<siaw23>
nitric: what that EOS stand for? i saw it a lot lately
<siaw23>
smathy: yes
swills has quit [Quit: Leaving]
<nitric>
siaw23: "end of string", but you can use any string you want: EOF is another common one for "end of file"
swills has joined #ruby
<siaw23>
zenspider: to avoid the repitition of “fh” or “<<“
<smathy>
siaw23, make a hash or array ahead of time and then iterate over it in your CSV.open block if you prefer.
<smathy>
It won't really be shorter, but you'll have removed that `fh << ` process duplication.
<nitric>
"heredoc" is a catchall term for a multiline string that is terminated by a fixed, known string such as "EOS" or "the_end_of_my_multiline_string" or any other legal string
<siaw23>
smathy: more like it :)
ChiefAlexander has quit [Remote host closed the connection]
solars has joined #ruby
marxarelli has quit [Ping timeout: 244 seconds]
dreamyspell has joined #ruby
<smathy>
siaw23, comment in your gist.
<siaw23>
more like it. thanks :)
<smathy>
Np.
sp3 has quit [Quit: Connection closed for inactivity]
sepp2k has quit [Read error: Connection reset by peer]
JeanCarloMachado has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
aegis3121 has quit [Ping timeout: 244 seconds]
kavanagh has quit [Quit: That's all folks!]
<zenspider>
siaw23: the code is fine as it is.
joonty has quit [Quit: This computer has gone to sleep]
hahuang61 has joined #ruby
<siaw23>
zenspider: thanks :)
capitainIsh has joined #ruby
SCHAAP137 has quit [Quit: Leaving]
Xeago has quit [Ping timeout: 240 seconds]
axl_ has quit [Quit: axl_]
<capitainIsh>
quick question about ruby: what's the difference between a = "hello written outside of functions/classes and $b = "hello"
axl_ has joined #ruby
der-landgraf has joined #ruby
<jhass>
the former creates a local variable, the latter creates a global variable
Xeago has joined #ruby
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hahuang61 has quit [Ping timeout: 250 seconds]
unreal has joined #ruby
<jhass>
?crosspost capitainIsh
<ruby[bot]>
capitainIsh: Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
<jhass>
matthewd: ^
rodfersou has quit [Quit: leaving]
hutch34 has quit [Quit: WeeChat 1.5]
xlegoman has joined #ruby
matp has quit [Ping timeout: 244 seconds]
anisha_ has quit [Quit: This computer has gone to sleep]
polishdub has quit [Quit: Leaving]
Es0teric has joined #ruby
Es0teric has quit [Max SendQ exceeded]
Es0teric has joined #ruby
<capitainIsh>
ah gotcha. my apologies.
replay has joined #ruby
replay has quit [Client Quit]
replay has joined #ruby
ebbflowgo has joined #ruby
maloik has quit [Remote host closed the connection]
maloik has joined #ruby
nitric has quit [Read error: Connection reset by peer]
nitric_ has joined #ruby
mozzarella has quit [Remote host closed the connection]
nitric_ has quit [Max SendQ exceeded]
mozzarella has joined #ruby
smathy has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
smathy has joined #ruby
<havenwood>
capitainIsh: Rubists generally avoid defining their own global variables.
smathy has quit [Client Quit]
spudowiar has joined #ruby
<capitainIsh>
thanks, havenwood. I was just wondering because I thought making a variable at the very top level actually creates a global variable without th $
<capitainIsh>
apparently, it's local, but is also accessible to every other method/variable you create?
<havenwood>
capitainIsh: Nope, that's still a local variable, it's just bound to `main`.
borodin has quit [Ping timeout: 250 seconds]
<capitainIsh>
i see, so what wouldn't be able to access the local variable at the top level (main)?
<zenspider>
any method, class, or module body
someguy has joined #ruby
spider-mario has quit [Remote host closed the connection]
JeanCarloMachado has quit [Ping timeout: 276 seconds]
<capitainIsh>
understood. thanks guys. i've just realized that all the index variables i've been working with have been inside of functions, or was a part of the top level altogether.
<capitainIsh>
i'm thinking of changing my un to rubyNewbie
firstdayonthejob has quit [Ping timeout: 240 seconds]
LoneHerm_ has quit [Remote host closed the connection]
<someguy>
Can someone tell me the ruby equivalent for Java's cert.getPublicKey().getEncoded()?
<someguy>
Specifically the getEncoded() part
<shellie_>
experienced rubyists, what are some well written / clear ruby applications you would recommend a newbie for inspiration?
nitric has joined #ruby
<jhass>
someguy, to_pem I guess?
fmcgeough has joined #ruby
eljimmy has joined #ruby
zodiac19 has joined #ruby
dr0lan has quit [Ping timeout: 240 seconds]
tvw has quit [Read error: Connection reset by peer]
zodiac19 has left #ruby [#ruby]
chris349 has joined #ruby
ftj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
solars has quit [Ping timeout: 276 seconds]
Silthias has quit [Ping timeout: 244 seconds]
roflmyeggo has joined #ruby
<someguy>
jhass: I don't think so. getEncoded() is supposed to return a byte array.
roflmyeggo has quit [Client Quit]
<someguy>
jhass: the docs say "Returns the key in its primary encoding format, or null if this key does not support encoding."
macsteps has joined #ruby
roflmyeggo has joined #ruby
blackgoat has quit [Ping timeout: 244 seconds]
the_rhizo2 has joined #ruby
the_rhizo has quit [Ping timeout: 258 seconds]
Asher has quit [Quit: Leaving.]
<jhass>
to_der then
ctp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
JeanCarloMachado has joined #ruby
Velizar has quit [Quit: Velizar]
solars has joined #ruby
craigp_ has quit [Ping timeout: 250 seconds]
ereslibre_laptop is now known as ereslibre
Asher has joined #ruby
Bugboy1028 has quit [Remote host closed the connection]
cschneid_ has quit [Remote host closed the connection]
matp has joined #ruby
ruid has joined #ruby
ruid has quit [Changing host]
ruid has joined #ruby
memorasus has quit [Remote host closed the connection]
ctp has joined #ruby
etetz has quit [Remote host closed the connection]
Bugboy1028 has joined #ruby
nofxx has quit [Ping timeout: 276 seconds]
hahuang61 has joined #ruby
ptierno has quit [Quit: Lost terminal]
Bugboy1028 has quit [Client Quit]
whathappens has quit [Remote host closed the connection]