<wixad_>
hi all im trying to implement OptionParser to ruby quiz when i call the script it just returns the passed in argument instend of changing the size of the digits here is the code
<shevy>
https://rubygems.org/stats interesting that mime-types is one of the top ten most downloaded gems ... is it pulled in via some other dep dependency perhaps?
k3rn31 has quit [Quit: Computer has gone to sleep.]
terminalrecluse has joined #ruby
gix has quit [Ping timeout: 244 seconds]
giz|work has quit [Ping timeout: 260 seconds]
mattwashere has quit [Remote host closed the connection]
<Radar>
shevy: It's a Rails dependency.
hutch34 has quit [Ping timeout: 260 seconds]
karmatr0n has joined #ruby
gix has joined #ruby
edwardly has quit [Max SendQ exceeded]
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
karmatr0n has quit [Ping timeout: 252 seconds]
jancel has joined #ruby
blackmesa has joined #ruby
Bear_ has quit [Read error: Connection reset by peer]
LoneHerm_ has quit [Remote host closed the connection]
pwnd_nsfw has joined #ruby
hutch34 has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kareeoleez has joined #ruby
hk238 has joined #ruby
jancel has quit [Ping timeout: 272 seconds]
ornerymoose has quit [Quit: ornerymoose]
blackmesa has quit [Ping timeout: 276 seconds]
<shevy>
ah ok
hutch34 has quit [Ping timeout: 276 seconds]
saneax is now known as saneax_AFK
<Radar>
through actionpack I think
pawnbox has joined #ruby
mattwashere has joined #ruby
pawnbox has quit [Ping timeout: 260 seconds]
mattwashere has quit [Ping timeout: 244 seconds]
k3rn31 has joined #ruby
charliesome has joined #ruby
craigp has quit [Ping timeout: 244 seconds]
voodoofish430 has joined #ruby
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Rinzlit has joined #ruby
rkazak has joined #ruby
pawnbox has joined #ruby
xall has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
xall has quit [Ping timeout: 250 seconds]
xlegoman has quit [Quit: Leaving]
pawnbox has quit [Remote host closed the connection]
<amincd>
yea, I see how it works now (I think). I just don't understand in what contexts it would be useful
giz|work has joined #ruby
<Radar>
[14:48:07] <Radar>My guess is that it's implemented in case you have some other object you want to convert to an IO.
<Radar>
[14:48:15] <Radar>and you're not sure if that object is already an IO object or if it's that other kind of object.
d0nn1e has joined #ruby
<amincd>
but does this method convert non-IO objects into IO objects?
conta has joined #ruby
<Radar>
No.
pontiki has quit [Quit: "Poets have been mysteriously silent on the subject of cheese." -- G.K.Chesterson]
<Radar>
this method only exists on objects of the IO class.
pontiki has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<amincd>
correct me if I'm wrong, but does this " you're not sure if that object is already an IO object or if it's that other kind of object." mean "use IO#to_io to test if the object is an IO object"?
<Radar>
I am confused by your use of "test"
<Radar>
test to me would mean that it would return true/false depending on if the object is an IO or not
<amincd>
true it's not a classical test
<pontiki>
more like "ensure"
laska has joined #ruby
<amincd>
pontiki: there that's the word
harfangk has joined #ruby
SilverKey has joined #ruby
<amincd>
ok it's clear to me now, thanks a lot
<pontiki>
note that i was remarking on grammar, not accuracy of Ruby methods
<amincd>
I'm just going to assume this is what the method does
dh64 has quit [Quit: Konversation terminated!]
<Radar>
Yes, its likely intended design is to ensure you always end up with an IO object.
arescorpio has quit [Quit: Leaving.]
laska has quit [Client Quit]
laska has joined #ruby
<laska>
exit
webus has joined #ruby
laska has quit [Client Quit]
ngw has joined #ruby
coyo has quit [Read error: Connection reset by peer]
LoneHerm_ has joined #ruby
kareeoleez has quit [Remote host closed the connection]
someish has quit [Quit: someish]
DTZUBDUB has quit [Ping timeout: 244 seconds]
evansbee has joined #ruby
howdoi has joined #ruby
LoneHerm_ has quit [Ping timeout: 264 seconds]
conta has quit [Ping timeout: 246 seconds]
evansbee has quit [Ping timeout: 250 seconds]
ngw has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
binaryplease1 has joined #ruby
saneax_AFK is now known as saneax
arooni has quit [Ping timeout: 250 seconds]
binaryplease has quit [Ping timeout: 258 seconds]
xall has joined #ruby
amincd has quit [Ping timeout: 250 seconds]
dionysus69 has joined #ruby
jpterry has quit [Quit: ZNC Quit]
certainty has joined #ruby
giz|work has quit [Ping timeout: 240 seconds]
craigp has joined #ruby
SilverKey has quit [Quit: Halted.]
lightt has quit [Remote host closed the connection]
xall has quit [Ping timeout: 250 seconds]
certainty has quit [Ping timeout: 252 seconds]
binaryplease1 is now known as binaryplease
zacstewa1t has quit [Ping timeout: 240 seconds]
jancel has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
Dimik has joined #ruby
jpterry has joined #ruby
giz|work has joined #ruby
tmtwd has quit [Ping timeout: 244 seconds]
northfurr has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
ur5us has quit [Remote host closed the connection]
jancel has quit [Ping timeout: 250 seconds]
certainty has joined #ruby
karmatr0n has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Sammichmaker has joined #ruby
pawnbox has quit [Remote host closed the connection]
hahuang62 has joined #ruby
pawnbox has joined #ruby
dionysus69 has quit [Ping timeout: 244 seconds]
Guest15111 is now known as awk
karmatr0n has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
safe has quit [Quit: Leaving]
certainty has quit [Ping timeout: 244 seconds]
hahuang62 has quit [Ping timeout: 272 seconds]
hutch34 has joined #ruby
LoneHerm_ has joined #ruby
mercerist has joined #ruby
blackmesa has quit [Ping timeout: 260 seconds]
hutch34 has quit [Ping timeout: 244 seconds]
last_staff has joined #ruby
giz|work has quit [Ping timeout: 260 seconds]
abprime has joined #ruby
abprime has quit [Client Quit]
apofis has joined #ruby
yardenbar has joined #ruby
n1x-nz has joined #ruby
d0lph1n98 has joined #ruby
apofis has quit [Max SendQ exceeded]
kareeoleez has joined #ruby
certainty has joined #ruby
charliesome has joined #ruby
Yiota has joined #ruby
duncannz has joined #ruby
jas02 has joined #ruby
tcopeland1 has joined #ruby
northfurr has quit [Quit: northfurr]
tcopeland has quit [Ping timeout: 252 seconds]
snsei has quit [Remote host closed the connection]
charliesome has quit [Client Quit]
DTZUBDUB has joined #ruby
AlexRussia has quit [Ping timeout: 240 seconds]
vuoto has quit [Remote host closed the connection]
DTZUBDUB has quit [Ping timeout: 244 seconds]
k3rn31 has quit [Quit: Computer has gone to sleep.]
saneax is now known as saneax_AFK
amclain has quit [Quit: Leaving]
mercerist has quit [Quit: Computer has gone to sleep.]
lightt has joined #ruby
vuoto has joined #ruby
the_drow has joined #ruby
Nawn has joined #ruby
bluOxigen has quit [Ping timeout: 250 seconds]
certainty has quit [Ping timeout: 240 seconds]
blaxter has joined #ruby
edwinvdgraaf has quit [Remote host closed the connection]
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lightt has quit [Remote host closed the connection]
Nawn has quit [Remote host closed the connection]
xall has joined #ruby
koooge has quit [Quit: Leaving...]
firstdayonthejob has joined #ruby
last_staff has quit [Quit: last_staff]
zacstewart has joined #ruby
fenre has joined #ruby
xall has quit [Ping timeout: 250 seconds]
last_staff has joined #ruby
norc has joined #ruby
blaxter has quit [Quit: foo]
harfangk has quit [Quit: harfangk]
CloCkWeRX has quit [Ping timeout: 258 seconds]
aganov has joined #ruby
zacstewart has quit [Ping timeout: 250 seconds]
n1x-nz has quit [Ping timeout: 244 seconds]
Hobogrammer has quit [Quit: WeeChat 0.4.2]
jxs__ has joined #ruby
flughafen_ has joined #ruby
DTZUBDUB has joined #ruby
dh64 has joined #ruby
tildes has joined #ruby
jaiks1 has quit [Ping timeout: 250 seconds]
flughafen has quit [Ping timeout: 264 seconds]
webus has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
karmatr0n has joined #ruby
conta has joined #ruby
Ishido has joined #ruby
bluOxigen has joined #ruby
bigkevmcd has joined #ruby
xall has joined #ruby
vuoto has quit [Remote host closed the connection]
firstdayonthejob has quit [Ping timeout: 260 seconds]
karmatr0n has quit [Ping timeout: 260 seconds]
agentmeerkat has joined #ruby
mercerist has joined #ruby
rdark has quit [Quit: leaving]
ecksit has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blackmesa has joined #ruby
DTZUBDUB has quit [Ping timeout: 250 seconds]
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
xall has quit [Ping timeout: 250 seconds]
tmtwd has joined #ruby
dionysus69 has joined #ruby
nankyokusei has joined #ruby
ramfjord has joined #ruby
agentmeerkat has quit [Ping timeout: 272 seconds]
blackmesa has quit [Ping timeout: 260 seconds]
Niham has joined #ruby
codecop has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
nankyokusei has quit [Ping timeout: 260 seconds]
CloCkWeRX has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
djbkd has joined #ruby
bigkevmcd has quit [Read error: Connection reset by peer]
bigkevmcd has joined #ruby
kies has joined #ruby
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
saneax_AFK is now known as saneax
giz|work has joined #ruby
k3rn31 has joined #ruby
mercerist has quit [Quit: Computer has gone to sleep.]
jgt1 has joined #ruby
Zarthus has quit [Quit: I can't go to hell. I'm all out of vacation days.]
Zarthus has joined #ruby
certainty has joined #ruby
lsmola has joined #ruby
fenre_ has joined #ruby
Niham has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fenre__ has joined #ruby
fenre has quit [Ping timeout: 260 seconds]
Hounddog has joined #ruby
fenre_ has quit [Ping timeout: 240 seconds]
n1x-nz has joined #ruby
DTZUBDUB has joined #ruby
wuyin has quit [Ping timeout: 250 seconds]
evansbee has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
bluOxigen has quit [Ping timeout: 250 seconds]
bluOxigen has joined #ruby
evansbee has quit [Ping timeout: 260 seconds]
jgt1 has quit [Ping timeout: 244 seconds]
fenre__ has quit [Remote host closed the connection]
LoneHerm_ has quit [Remote host closed the connection]
bumao has joined #ruby
fenre has joined #ruby
tmtwd has quit [Ping timeout: 246 seconds]
xall has joined #ruby
neanderslob has joined #ruby
neanderslob has quit [Disconnected by services]
neanderslob_ has joined #ruby
yfeldblum has quit [Ping timeout: 250 seconds]
solars has joined #ruby
neanderslob has joined #ruby
tmtwd has joined #ruby
solocshaw has quit [Ping timeout: 260 seconds]
madgen has joined #ruby
zacstewart has joined #ruby
edwinvdgraaf has joined #ruby
charliesome has joined #ruby
xall_ has joined #ruby
zacstewart has quit [Ping timeout: 240 seconds]
jaguarmagenta has quit [Remote host closed the connection]
djbkd has quit [Remote host closed the connection]
xall has quit [Ping timeout: 250 seconds]
DTZUBDUB has quit [Ping timeout: 244 seconds]
neanderslob has quit [Remote host closed the connection]
neanderslob_ has quit [Remote host closed the connection]
Wsewolod has joined #ruby
jaguarmagenta has joined #ruby
ur5us has joined #ruby
ta_ has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
terlar has joined #ruby
karmatr0n has joined #ruby
astrobunny has joined #ruby
andikr has joined #ruby
kknight has joined #ruby
karmatr0n has quit [Ping timeout: 276 seconds]
blackmesa has joined #ruby
tmtwd has quit [Ping timeout: 244 seconds]
multi_io has quit [Ping timeout: 240 seconds]
jaguarmagenta has quit [Remote host closed the connection]
mercerist has joined #ruby
harfangk has joined #ruby
biberu has joined #ruby
multi_io has joined #ruby
ngw has joined #ruby
dionysus69 has quit [Remote host closed the connection]
aberen has joined #ruby
blackmesa has quit [Ping timeout: 276 seconds]
yfeldblum has joined #ruby
startupality has joined #ruby
Dimik has quit [Ping timeout: 246 seconds]
startupality has quit [Client Quit]
startupality has joined #ruby
hutch34 has joined #ruby
Sashimi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Silthias has joined #ruby
Coldblackice has joined #ruby
hutch34 has quit [Ping timeout: 252 seconds]
tesuji_ has joined #ruby
ruby-lang193 has joined #ruby
Ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tvw has joined #ruby
tesuji_ has quit [Read error: Connection reset by peer]
ruby-lang193 has quit [Client Quit]
giz|work has quit [Ping timeout: 244 seconds]
Cyneyt has joined #ruby
giz|work has joined #ruby
vondruch has joined #ruby
elaptics`away is now known as elaptics
ethereon has quit [Ping timeout: 276 seconds]
symm- has joined #ruby
ljames has joined #ruby
jaruga___ has joined #ruby
kedare has joined #ruby
charliesome has joined #ruby
charliesome has quit [Ping timeout: 276 seconds]
moty66 has quit [Remote host closed the connection]
the_drow has joined #ruby
charliesome has joined #ruby
skade has joined #ruby
charliesome has quit [Client Quit]
DoubleMalt has joined #ruby
rkoller has joined #ruby
Mon_Ouie has joined #ruby
araujo has joined #ruby
madgen has quit [Ping timeout: 276 seconds]
zacstewart has joined #ruby
giz|work has quit [Ping timeout: 260 seconds]
DTZUBDUB has joined #ruby
startupality has quit [Quit: startupality]
joneshf-laptop has quit [Ping timeout: 240 seconds]
hutch34 has joined #ruby
mrgrieves has joined #ruby
stan has quit [Ping timeout: 276 seconds]
zacstewart has quit [Ping timeout: 260 seconds]
DTZUBDUB has quit [Ping timeout: 250 seconds]
startupality has joined #ruby
hutch34 has quit [Ping timeout: 244 seconds]
ngw has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
weckl has joined #ruby
jericon_ is now known as jericon
startupality has quit [Ping timeout: 252 seconds]
Moosashi has joined #ruby
pontiki has quit [Quit: "Poets have been mysteriously silent on the subject of cheese." -- G.K.Chesterson]
karmatr0n has joined #ruby
ramfjord has quit [Ping timeout: 272 seconds]
mikecmpbll has joined #ruby
giz|work has joined #ruby
ngw has joined #ruby
lxsameer has joined #ruby
mooru has joined #ruby
<p1k>
what is the JSON method to parse a string literal ? e.g. "42"
mooru has quit [Max SendQ exceeded]
marr has joined #ruby
mooru has joined #ruby
karmatr0n has quit [Ping timeout: 260 seconds]
senayar has joined #ruby
senayar has quit [Changing host]
senayar has joined #ruby
arlek has joined #ruby
<apeiros>
p1k: you'll have to use a non-standard-lib json library. ruby's json library still uses an older spec of json, where only objects and arrays are valid root elements.
arlek has quit [Read error: Connection reset by peer]
blackmesa has joined #ruby
nankyokusei has joined #ruby
<apeiros>
you can use JSON.load, but not sure about the security implications (its docs warn from using it on userinput)
<xpt>
/part
<xpt>
whops
xpt has left #ruby ["too many buffers to handle :("]
tesuji_ has joined #ruby
salexa has joined #ruby
blackmesa has quit [Ping timeout: 244 seconds]
futilegames has joined #ruby
nankyokusei has quit [Ping timeout: 264 seconds]
jgt1 has joined #ruby
f4cl3y has joined #ruby
moeabdol has joined #ruby
stan has joined #ruby
xall_ has quit [Ping timeout: 240 seconds]
futilegames has quit [Quit: futilegames]
JammyHammy has quit [Read error: Connection reset by peer]
ocbtec has joined #ruby
solocshaw has joined #ruby
futilegames has joined #ruby
ur5us has quit [Remote host closed the connection]
futilegames has quit [Client Quit]
jancel has joined #ruby
Rickmasta has joined #ruby
jancel has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
evansbee has joined #ruby
vuoto has joined #ruby
jinie has quit [Max SendQ exceeded]
czerasz has joined #ruby
jinie has joined #ruby
yfeldblum has quit [Ping timeout: 250 seconds]
workmad3 has joined #ruby
ta__ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
evansbee has quit [Ping timeout: 260 seconds]
Moosashi has quit [Quit: Moosashi]
vuoto has quit [Remote host closed the connection]
czerasz has quit [Quit: Ex-Chat]
infra-red has joined #ruby
Moosashi has joined #ruby
araujo_ has joined #ruby
infra-red has quit [Client Quit]
fenre has quit [Remote host closed the connection]
salexa has left #ruby ["PART ##machinelearning :PART #learnprogramming :PART ##namespace :PONG :asimov.freenode.net"]
araujo has quit [Ping timeout: 252 seconds]
araujo_ has quit [Client Quit]
ferr1 has joined #ruby
joes_ has joined #ruby
zacstewart has joined #ruby
blackmesa has joined #ruby
Coldblackice has quit [Ping timeout: 276 seconds]
joes_ has quit [Client Quit]
hutch34 has joined #ruby
postmodern has quit [Quit: Leaving]
Moosashi has quit [Quit: Moosashi]
zacstewart has quit [Ping timeout: 260 seconds]
joes_ has joined #ruby
duncannz has quit [Remote host closed the connection]
hutch34 has quit [Ping timeout: 244 seconds]
Niham has joined #ruby
guardianJ has joined #ruby
charliesome has joined #ruby
karmatr0n has joined #ruby
saneax is now known as saneax_AFK
ur5us has quit [Remote host closed the connection]
agentmeerkat has joined #ruby
madgen has joined #ruby
karmatr0n has quit [Ping timeout: 258 seconds]
Snowy has joined #ruby
fenre has joined #ruby
jaguarmagenta has joined #ruby
johnmilton has quit [Quit: Namaste]
agentmeerkat has quit [Ping timeout: 272 seconds]
chip_ has joined #ruby
guardianJ has left #ruby [#ruby]
jaguarmagenta has quit [Ping timeout: 276 seconds]
rikkipitt has joined #ruby
n1x-nz has quit [Quit: Computer says no]
CloCkWeRX has quit [Ping timeout: 276 seconds]
ta_ has joined #ruby
sameerynho has joined #ruby
ta__ has quit [Ping timeout: 244 seconds]
lxsameer has quit [Ping timeout: 240 seconds]
tcopeland1 has quit [Quit: Leaving.]
FooMunki has quit [Read error: Connection reset by peer]
FooMunki has joined #ruby
workmad3 has quit [Quit: Lost terminal]
workmad3 has joined #ruby
harfangk has quit [Quit: harfangk]
<marahin>
Hello. Having an array of addresses, what is the proper way to find closest address from the array, when given another specific location?
<marahin>
There is Geocoder, but as I see it requires Rails / something with models, and I want to keep it as simple as possible.
Sashimi has joined #ruby
<p1k>
apeiros: I see, thanks
fenre has quit [Remote host closed the connection]
<marahin>
jhass, uh... Pardon me, as I am a learning person: the method shown seems to be only searching for a place, and I particularly have to find a place from @array, that is closest to @another_place
<marahin>
so in pseudocode I'd do like @array.closest( @another_place ) or something.
<jhass>
I was just hinting the fact that while it's focused on usage inside AR, it is not required
<marahin>
that is true
harfangk has joined #ruby
platzhirsch has joined #ruby
<marahin>
and I am aware of that :( it's just that it's rather a CLI program, I don't need (and want ActiveRecord) for that
<marahin>
so, any idea how can I bite this?
<platzhirsch>
What's the nicest way of adding a constant for a long string which you can break over multiple lines without
<platzhirsch>
\n are added to it?
CloCkWeRX has joined #ruby
<jhass>
platzhirsch: you can use \ at the end of a line inside "", %() and heredocs too
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<platzhirsch>
jhass: that seems reasonable
p0p0pr37 has quit [Remote host closed the connection]
<jhass>
marahin: map all your addresses to geo coordinates using search, then to distances using Geocoder::Calculations.distance_between and then just #min_by
CloCkWeRX has quit [Ping timeout: 260 seconds]
ta__ has joined #ruby
p0p0pr37 has joined #ruby
Snowy has quit [Quit: ragequit]
Sashimi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dionysus69 has joined #ruby
Gasher has joined #ruby
jaguarmagenta has quit [Remote host closed the connection]
k3rn31 has quit [Quit: Computer has gone to sleep.]
ornerymoose has quit [Ping timeout: 250 seconds]
kknight has quit [Quit: Leaving]
d0lph1n98 has quit [Ping timeout: 260 seconds]
Vingador_ has joined #ruby
<Dysp>
Okay, stuck another (for me) hard one. I have an array [1, 2, 3, 4] for each element I want to divide by each element in another array [0, 1, 2, 3, 4], starting from the 1st position. (Not 0th).
<Dysp>
struck*
<Dysp>
Using map would work, but how I get the other array into work I can't figure out
blackmesa has quit [Ping timeout: 250 seconds]
Vingador has quit [Ping timeout: 272 seconds]
diegoaguilar has joined #ruby
<lupine>
you could zip then map
DTZUBDUB has joined #ruby
<jhass>
Dysp: starting from the 1st position of both arrays or just shifting the other by 1?
<Dysp>
No, only the second one.
<jhass>
as.zip(bs.drop(1)).map {|a, b| a / b }
<Dysp>
Hmm.
<Dysp>
I'll try to understand it :d
<Dysp>
ty!
<lupine>
the first time I came across Array#zip, I thought "why?!?!"
<jhass>
alternative: as.map.with_index(1) {|a, i| a / bs[i] }
hutch34 has joined #ruby
<Dysp>
If it wasn't for you guys, I would never have learned to program.
diegoaguilar has quit [Max SendQ exceeded]
<Dysp>
I consider myself a proud phase 2 newb now ^^
diegoaguilar has joined #ruby
harfangk has quit [Quit: harfangk]
<Dysp>
After reading the api for zip, I now know exactly as little as I did when I started reading the api.
mradmacher has joined #ruby
saneax is now known as saneax_AFK
<ltd>
it's a confusing function, i'll admit
<Dysp>
Some day. :d
joneshf-laptop has joined #ruby
<ltd>
one i've not had an application for yet tbh
hutch34 has quit [Ping timeout: 244 seconds]
hanmac has quit [Ping timeout: 258 seconds]
fenre_ has joined #ruby
blackgoat has quit [Quit: WeeChat 1.5]
tesuji_ has quit [Read error: Connection reset by peer]
tesuji_ has joined #ruby
rikkipitt has quit [Remote host closed the connection]
tesuji_ has quit [Read error: Connection reset by peer]
<jhass>
the most common real world usecase is something like keys.zip(values).to_h
rikkipitt has joined #ruby
senayar has joined #ruby
d0lph1n98 has joined #ruby
fenre has quit [Ping timeout: 260 seconds]
tesuji_ has joined #ruby
karmatr0n has joined #ruby
tesuji_ is now known as tesuji
blackmesa has joined #ruby
karmatr0n has quit [Ping timeout: 260 seconds]
bigkevmcd has quit [Quit: Outta here...]
dionysus69 has joined #ruby
hanmac has joined #ruby
ldnunes has joined #ruby
Cyneyt has quit [Quit: Page closed]
bigkevmcd has joined #ruby
ornerymoose has joined #ruby
SirOliver has joined #ruby
pawnbox has quit [Remote host closed the connection]
<workmad3>
crankharder: because the `should` block is being instance_evaled on an instance of a test class that provides `assert`, whilst your proc is being run with the context of the top-level TestCase class (which doesn't have access to `assert`)
someish has joined #ruby
eljimbo has joined #ruby
garethrees is now known as ghr
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
imperator has joined #ruby
pandaant has quit [Remote host closed the connection]
<crankharder>
workmad3: seems odd to me that the context switches
someish has quit [Client Quit]
<crankharder>
curious if you see a workaround?
Hounddog has quit [Remote host closed the connection]
moeabdol has quit [Ping timeout: 260 seconds]
snath has joined #ruby
infra-red has quit []
<Mon_Ouie>
instance_eval(&p), or pass self as a parameter to p
<norc>
crankharder: instance eval the block
* norc
sighs.
* norc
is just too slow for this world.
joast has quit [Ping timeout: 276 seconds]
agentmeerkat has joined #ruby
<shevy>
haha
M-Kodo has joined #ruby
dionysus69 has quit [Remote host closed the connection]
troulouliou_div2 has joined #ruby
Hounddog has joined #ruby
craigp has joined #ruby
CJKinni has joined #ruby
AcidCras_ is now known as AcidCrash
xcesariox has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aryaching has quit [Ping timeout: 244 seconds]
jrafanie has joined #ruby
CJKinni has quit [Read error: Connection reset by peer]
CJKinni has joined #ruby
aryaching has joined #ruby
mattwashere has joined #ruby
dionysus69 has joined #ruby
frem_ has joined #ruby
snath has quit [Ping timeout: 250 seconds]
malconis has joined #ruby
zacstewart has joined #ruby
hutch34 has quit [Ping timeout: 276 seconds]
nettoweb has quit [Read error: Connection reset by peer]
nettoweb has joined #ruby
sameerynho has quit [Quit: WeeChat 1.5]
roamingdog has quit [Remote host closed the connection]
SilverKey has joined #ruby
zacstewart has quit [Ping timeout: 260 seconds]
roamingdog has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
blackmes1 has joined #ruby
karmatr0n has joined #ruby
ChiefAlexander_ has quit [Remote host closed the connection]
madgen has quit [Read error: Connection reset by peer]
madgen has joined #ruby
bmurt has joined #ruby
shinnya has quit [Ping timeout: 260 seconds]
prestorium has joined #ruby
snath has joined #ruby
ponga has joined #ruby
karmatr0n has joined #ruby
giz|work has joined #ruby
rikkipitt has joined #ruby
gettalong has joined #ruby
<Dysp>
jhass: Am I so lucky that you are available at this very moment?
AlexRussia has joined #ruby
DTZUBDUB has quit [Ping timeout: 260 seconds]
SilverKey has quit [Quit: Halted.]
<jhass>
Dysp: just ask your question, don't focus on people to answer them
iCHAIT_ has left #ruby [#ruby]
<Dysp>
Haha, I have no question. You are just my favorite grammar nazi and I've refactored my code; hopefully for the better. I was wondering if you would take a look at it and yell at me, like you normally do!
<Dysp>
(And I can't access gist because of slow internet atm, so I cannot just post..)
Yiota has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
fenre has quit [Remote host closed the connection]
symm- has quit [Ping timeout: 276 seconds]
joonty has joined #ruby
ta__ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
karmatr0n has quit [Read error: Connection reset by peer]
pocketprotector has quit [Ping timeout: 258 seconds]
greg has quit [Remote host closed the connection]
karmatr0n has joined #ruby
<jhass>
"Can I get this code reviewed?" is a perfectly fine, open question
Snowy has quit [Remote host closed the connection]
<Mon_Ouie>
#extract_values can be rewritten using sheets.map { … } instead of building an array explicitly
pocketprotector has joined #ruby
d10n-work has joined #ruby
<Dysp>
I actually do have a specific question. All these "nested" functions - is there a proper way of ordering them? I mean; some functions are divided into subfunctions and my natural intuition would tell me do indent these, so it shows. But is this bad practice?
<Dysp>
Mon_Ouie: I'll take a look! Ty
ponga has quit []
bluOxigen has quit [Ping timeout: 244 seconds]
<Mon_Ouie>
You mean if one method calls another method?
<aegis3121>
On your ifs, unless you really need to check against booleans, no need to check == true. if positive?(val) is the same as if positive?(val) == true in terms of truthiness
<Mon_Ouie>
I would usually put the high-level API at the top and utility methods used to define these methods at the end (possibly indicating them as private)
<Dysp>
I mean like.. I have one function called "calculate", which again uses a shit tonne of other functions. These other functions would never be used by anything else.
<Dysp>
Oh, yeah, the truthiness is implicit, right?
<aegis3121>
You can always make a second class that handles the calculations
<aegis3121>
then it looks less cluttered in this class by pulling it into the class that needs to know how to do that.
<aegis3121>
Dysp: yup. Anything except nil and false is truthy.
<Dysp>
Ah okay, so there isn't really any proper way of doing it. Seems like it depends on what you demand from it.
<jhass>
Dysp: Clean Code recommends to put the highest level methods at the start and order the other methods in call order below them; so def public_api; a; b; end; private; def a; end; def b; end;
<Dysp>
Alrighty.
<jhass>
that is order of first call
<jhass>
that usually naturally leads to something you can read top down
<Dysp>
Another question for ya'll.
<aegis3121>
#positive? doesn't need the if/else; `array.inject(:+).quo(array.size) > 0` would be sufficient for the entire method
axl_ has joined #ruby
craigp has quit [Ping timeout: 272 seconds]
pocketprotector has quit [Ping timeout: 246 seconds]
<Dysp>
Now I have created an object with the instance variables I need; how do access these variables? I've seen that you can access these via "instance get" or something. But then I was told that wasn't a good way of doing it?
<aegis3121>
creating attr_reader :name_of_ivar would work
<Dysp>
I cannot search the interwebs right now, as I think the web/DNS/whatever of my workplace is crashing
<Dysp>
So it is the attr_reader I need to read up on.
SilverKey has joined #ruby
<aegis3121>
then use it like any other method name. attr_reader :something; def foobar; puts something; end
chip_ has quit [Ping timeout: 260 seconds]
pocketprotector has joined #ruby
<Dysp>
If I were to use something like foobar.r1.mvc, would I need to create that sort of API?
<Dysp>
To extract the mvc from r1.
ebbflowgo has joined #ruby
<Dysp>
Right now it is {right => {"r1" => {.... mvc: mvc... }...}
palms has joined #ruby
<aegis3121>
you would need to make r1 an object rather than a hash, yes. Otherwise accessing it like a hash would work.
dangerou_ has joined #ruby
hk238 has joined #ruby
swills has joined #ruby
<Dysp>
r1 is a hash within a hash within a hash right now.
<Dysp>
You are saying I should somehow pull it out and make it its own object when called upon?
<aegis3121>
If you want to access it like that, yes. If you're fine doing hash[:right]['r1'][:mvc], then I'd leave it like that. It's personal preference, though objects are nicer. Just have to weight out if the effort is worth any benefits.
chip_ has joined #ruby
Dimik has joined #ruby
<Dysp>
Well, eventually I will be creating some kind of frontend that should be able to pull every single tiny detail.
<Dysp>
Hopefully fully customizable.
beneggett has quit [Quit: ...zzz ¯\_(ツ)_/¯ zzz...]
<Dysp>
To be honest I don't know which approach to go with. Eventually I will of course just go with whatever works and then refactor when I learn more.
<jhass>
Dysp: rename all variables until none of them have the words array or hash in them. Name them after the data they represent, not its structure
<jhass>
Array[] is a rather verbose way to write []
<Dysp>
You are right and I will do that. I simply did call them something with array/hash, so I could find my own way around them.
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gfvcastro has joined #ruby
jaguarmagenta has joined #ruby
<jhass>
ll 122-125 want to be a .map too
agent_white has joined #ruby
mattwashere has quit [Remote host closed the connection]
<Dysp>
Be aware; I am noting these things down :)
<agent_white>
Mornin'
<jhass>
each.with_index -> each_with_index
<Dysp>
Any difference?
diegoviola has joined #ruby
<jhass>
creates one less Enumerator instance
rikkipitt has quit [Remote host closed the connection]
<jhass>
or actually in this case just .map.with_index
gfvcastro has quit [Client Quit]
mdw has quit [Ping timeout: 258 seconds]
<jhass>
what's line 65 trying to do?, copy?
<Dysp>
What does the line start with?
rikkipitt has joined #ruby
<Dysp>
I posted comments
<Dysp>
fucked up the line numbers
<jhass>
first in def baseline
dionysus69 has quit [Ping timeout: 244 seconds]
<jhass>
data.first(100) already returns a new array
jaguarmagenta has quit [Ping timeout: 260 seconds]
<jhass>
less noisy?
<Dysp>
yes, sure. But doesn't the iteration come from the .each call?
<jhass>
the each_ made me think you have useless each loop in the first second
diegoaguilar has quit [Remote host closed the connection]
<jhass>
that reject! iterates is quite obvious
emilkarl has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
norc has quit [Ping timeout: 250 seconds]
jancel has joined #ruby
rikkipitt has quit [Ping timeout: 260 seconds]
SilverKey has quit [Quit: Halted.]
davedev24 has joined #ruby
joast has joined #ruby
<Dysp>
Alrighty. Also found a bug while at it.. Gotta work that bad boy out
<Dysp>
ty for all ya help
mdw has joined #ruby
mdw has quit [Max SendQ exceeded]
mdw has joined #ruby
jancel has quit [Ping timeout: 244 seconds]
SolarSailor has joined #ruby
iCHAIT_ has joined #ruby
tjohnson has joined #ruby
zacstewart has joined #ruby
kareeoleez has quit [Remote host closed the connection]
mikecmpb_ has joined #ruby
bmurt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Dysp>
Considering I have a long-ass array with data (data), why does this: [0, 1, 2, 3, 4].each do { |t| array << data.fetch(t. nil) } return an array with [0, 1, 2, 3, 4]?
mikecmpbll has quit [Ping timeout: 260 seconds]
<Dysp>
Oh, the dot should be a comma.
<Dysp>
Typing mistake
zacstewart has quit [Ping timeout: 260 seconds]
bmurt has joined #ruby
jenrzzz has joined #ruby
SilverKey has joined #ruby
zacstewart has joined #ruby
rippa has joined #ruby
emilkarl has joined #ruby
aganov has quit [Ping timeout: 244 seconds]
<apeiros>
Dysp: because .each always returns the receiver
<Dysp>
So I need just to return the array?
<Dysp>
Which I append to
<apeiros>
I don't know what you need.
<Dysp>
Thank you, my light and savior.
<Dysp>
Oh sorry. Shared the code earlier, forgot that this was asked out of context
polishdub has joined #ruby
blackmes1 has quit [Ping timeout: 276 seconds]
chip_ has quit [Ping timeout: 260 seconds]
mooru has joined #ruby
CloCkWeRX has left #ruby [#ruby]
jenrzzz has quit [Ping timeout: 260 seconds]
nankyokusei has joined #ruby
terlar has quit [Ping timeout: 276 seconds]
ta__ has joined #ruby
<jhass>
Dysp: again, that's a .map
ta_ has quit [Read error: Connection reset by peer]
<Dysp>
Yeah, I am starting to get it ^^
<jhass>
or in this special case it's even a Array.new(5) {|t| }
dangerou_ has quit [Read error: Connection reset by peer]
mercerist has joined #ruby
jmignault has joined #ruby
pawnbox has quit [Read error: Connection reset by peer]
nankyokusei has quit [Ping timeout: 240 seconds]
ChiefAlexander has quit [Remote host closed the connection]
pawnbox has joined #ruby
dionysus69 has joined #ruby
e3c has joined #ruby
ChiefAlexander has joined #ruby
<Dysp>
Hm.
lalalaaa has joined #ruby
Dimik has quit [Ping timeout: 252 seconds]
<Dysp>
I am now starting to get back "inifity" when dividing by numbers that do definetly not equal to anything near infinity. Why is this?!
yardenbar has quit [Ping timeout: 260 seconds]
jrafanie_ has joined #ruby
<Dysp>
If I do 34,9 / 0,05 I am getting "infinity".
spiette has joined #ruby
weckl has quit [Quit: Leaving]
<Dysp>
Must be the code, though. ms_dif_nm.map!.with_index(1) { |a, i| a / (@time_values[i] / 1000) }
<Mon_Ouie>
And division by zero for floating point numbers is defined to be an infinity
<Dysp>
toretore: I am not sure exactly what I am doing here. Let me explain.
codecop has quit [Remote host closed the connection]
<Dysp>
I am trying to: For each element in 'a' divide by each element in 'b' (divided by 1000).
beneggett has quit [Client Quit]
<Dysp>
Except the 1st element, which is 0.
<Dysp>
So start from "1", not "0". Does it make sense?
tcopeland has joined #ruby
beneggett has joined #ruby
tcopeland has quit [Client Quit]
mensvaga has left #ruby [#ruby]
SilverKey has quit [Quit: Halted.]
<Dysp>
Mon_Ouie: You were of course right. The fixnum trap, as I call it.
dsea has joined #ruby
Xeago_ has joined #ruby
<toretore>
Dysp: need more context
`tim` has joined #ruby
mattwashere has joined #ruby
pawnbox has quit [Remote host closed the connection]
<Dysp>
If you want to know, I will tell you. But Mon_Ouie made me realize what is wrong and it now works.
dionysus69 has quit [Ping timeout: 260 seconds]
roamingdog has quit [Read error: Connection reset by peer]
blackmes1 has joined #ruby
roamingdog has joined #ruby
Xeago_ has quit [Ping timeout: 260 seconds]
mikecmpb_ has quit [Read error: Connection reset by peer]
mikecmpbll has joined #ruby
synthroid has quit [Remote host closed the connection]
Mattx has joined #ruby
Dysp has quit [Quit: Page closed]
conta has quit [Ping timeout: 240 seconds]
<Mattx>
Hey guys, any of you using MongoDB? I want to give it a try but I've found the documentation of the gem "mongo" is awful and in many cases outdated. Any idea?
kareeoleez has joined #ruby
<Mattx>
for instance there's a method called #hint(hash) to query documents, but all the doc says is "Provides the query with an index hint to use."
ta__ has quit [Read error: Connection reset by peer]
ta_ has joined #ruby
<Mattx>
Papierkorb, that's what I'm reading. check the example above. how are you supposed to use .hint?
polysics has joined #ruby
<Mattx>
or even #batch_size(integer), something way more useful
kareeoleez has quit [Remote host closed the connection]
<Mattx>
what's the default value? no idea...
<Papierkorb>
I just used #find for my 10 queries or so I ever needed to do with mongo
rodfersou is now known as rodfersou|lunch
kareeoleez has joined #ruby
<Papierkorb>
if there is no default given, you have to pass it anyway. if one is given and it is nil, it's probably a server selected value or so.
the_drow has quit [Quit: This computer has gone to sleep]
<Mattx>
well, my point is that it's not documented
<Mattx>
using find() surely selects a default batch_size
roamingdog has quit [Remote host closed the connection]
<Mattx>
or probably not, who knows :P
roamingdog has joined #ruby
mercerist has quit [Quit: Computer has gone to sleep.]
rikkipit_ has joined #ruby
l4v2 has joined #ruby
pawnbox has joined #ruby
spiette has quit [Ping timeout: 260 seconds]
<l4v2>
I am trying to do a tutorial for practicing testing, but when I run this command ‘bundle exec ruby tests/array_test.rb’ I get this error message -bash: /usr/local/bin/bundle: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rikkipitt has quit [Ping timeout: 246 seconds]
<l4v2>
It’s a unsupported version of Ruby now too 1.9.3
SolarSailor has joined #ruby
AcidCrash has quit [Read error: Connection reset by peer]
tesuji has quit [Killed (leguin.freenode.net (Nickname regained by services))]
karmatr0n has quit [Ping timeout: 260 seconds]
gettalong has quit [Ping timeout: 264 seconds]
AcidCrash has joined #ruby
crystal77 has joined #ruby
pawnbox has quit [Ping timeout: 272 seconds]
SolarSailor has quit [Client Quit]
tesuji_ has joined #ruby
jhack has joined #ruby
k3rn31 has joined #ruby
wrkrcoop has joined #ruby
pawnbox has joined #ruby
kies has quit [Ping timeout: 252 seconds]
pietr0 has joined #ruby
joes_ has quit [Quit: leaving]
banister has joined #ruby
`tim` has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
spiette has joined #ruby
emilkarl has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ChiefAlexander has quit [Remote host closed the connection]
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ChiefAlexander has joined #ruby
solars has joined #ruby
ItSANg___ has joined #ruby
<wrkrcoop>
from inside my ec2 instance i can get in irb and connect to S3, but for some reason in my app I can’t connect to S3 … any idaes on why this might be?
jenrzzz has quit [Ping timeout: 244 seconds]
moos3 has quit [Quit: leaving]
moos3 has joined #ruby
emilkarl has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ItSANgo has quit [Ping timeout: 272 seconds]
andikr has quit [Remote host closed the connection]
Vingador_ has quit [Ping timeout: 240 seconds]
elaptics is now known as elaptics`away
Xiti has quit [Quit: Xiti]
<imperator>
suggestions for handling an arbitrary list of (hash-based) filters on an array of complex objects?
<imperator>
right now i'm just iterating over the hash like: filter.each{ |k,v| list = list.select{ |x| x.send(k) == v } }
<imperator>
but i suspect there's a better way
ferr1 has quit [Quit: WeeChat 1.5]
hutch34 has quit [Quit: WeeChat 1.5]
jgt1 has quit [Ping timeout: 246 seconds]
jgt1 has joined #ruby
hutch34 has joined #ruby
cevett has joined #ruby
nerium has joined #ruby
axl_ has quit [Quit: axl_]
crystal77 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kies has joined #ruby
kedare has quit [Quit: Leaving]
Snowy has joined #ruby
bhjcps has joined #ruby
CloCkWeRX has quit [Ping timeout: 250 seconds]
edwinvdgraaf has quit [Ping timeout: 244 seconds]
rkazak has joined #ruby
mooru_ has joined #ruby
yardenbar has joined #ruby
mooru has quit [Ping timeout: 246 seconds]
aegis3121 has quit [Ping timeout: 260 seconds]
maucar has joined #ruby
kareeole_ has joined #ruby
joonty has quit [Quit: This computer has gone to sleep]
Yiota_ has joined #ruby
dhollinger has joined #ruby
amclain has joined #ruby
eGGshke has joined #ruby
rkazak has quit [Ping timeout: 252 seconds]
k3rn31 has quit [Quit: Computer has gone to sleep.]
mrgrieves has quit [Ping timeout: 276 seconds]
kies has quit [Ping timeout: 252 seconds]
`tim` has joined #ruby
mooru_ has quit [Ping timeout: 260 seconds]
<jhass>
mh, don't see anything much better, could list.select {|item| filters.all? {|field, expected_value| item.public_send(field) == expected_value } }
jaguarmagenta has quit [Ping timeout: 258 seconds]
moeabdol has joined #ruby
platzhirsch has quit [Quit: WeeChat 1.4]
the_drow has joined #ruby
vuoto has quit [Remote host closed the connection]
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jaruga___ has quit [Quit: jaruga___]
ramfjord has joined #ruby
iCHAIT_ has joined #ruby
GodFather has quit [Ping timeout: 250 seconds]
fujinuma has quit [Quit: WeeChat 1.5]
GodFather has joined #ruby
<CustosLimen>
so I want something that I can use to handle graceful shutdown - I made ShutdownHandler with wait method - so then I do shutdown_handler = ShutdownHandler.new - which traps signals with queue push... - and then I have wait method on ShutdownHandler that does queue.pop
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<CustosLimen>
even though stuff is being added to queue
<kareeoleez>
I have a gem which can be installed only in specific systems (RPI, gem: dht-sensor-ffi) and the only way to use it in my development vm is to comment it out each time. Is there any other way to control this ?
<CustosLimen>
I think this is maybe consequence of this all happening in one threads though
gfvcastro has quit [Client Quit]
troulouliou_div2 has quit [Quit: Leaving]
senayar has quit []
<CustosLimen>
;(
<Veejay>
Try to use queue.pop(true) and see if an exception is raised
<CustosLimen>
let me just send it to another thread
Vingador has joined #ruby
<CustosLimen>
Veejay, it will be as queue will be empty first time its called
d0lph1n98 has quit [Ping timeout: 250 seconds]
<Veejay>
If the queue is empty, queue.pop suspends the calling thread
<Veejay>
IIRC
<CustosLimen>
Veejay, yes - but the queue gets filled every time I send ctrl+c
VectorX has left #ruby [#ruby]
<CustosLimen>
Veejay, and in output (shared in bpaste) you can see queue getting bigger - but still pop does not return
<CustosLimen>
anyway - I'm pretty sure it wont work if its all in one thread
<CustosLimen>
so I have to redirect the queue to another thread
<CustosLimen>
and then redirect the event back to main thread
braincras has quit [Ping timeout: 244 seconds]
madgen has joined #ruby
KCmetro has quit [Remote host closed the connection]
hogetaro has joined #ruby
<jhass>
kareeoleez: you could add an environment variable to skip the check
<shevy>
\o/
<kareeoleez>
hmm
<jhass>
MY_GEM_SKIP_PLATFORM_CHECK=true
<shevy>
HERE_BE_DRAGONS=true
<kareeoleez>
there's also grouping and --without x
<jhass>
^ good one
<jhass>
oh
braincrash has joined #ruby
<jhass>
I didn't see bundler in the context of the question
<jhass>
--without is indeed preferable
mooru has joined #ruby
<jhass>
or if not needing it is actually the more common case, group :rpi, optional: true do; and do --with rpi on the pi
hogetaro_ has quit [Ping timeout: 260 seconds]
wrkrcoop has quit [Quit: wrkrcoop]
nankyokusei has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
Impaloo has joined #ruby
<Impaloo>
Hey, does anyone use ruby-switch(1) here?
<kareeoleez>
jhass: and what about the methods that use this gem ?
<jhass>
they should check defined?
<jhass>
?anyone Impaloo
<ruby[bot]>
Impaloo: Just ask your question, if anyone has, is or can, they will respond.
<kareeoleez>
jhass: for example <td><%= DhtSensor.read(4, 11).temperature %>*C</td> returns a uninitialized constant ActionView::CompiledTemplates::DhtSensor (obviously)
<jhass>
defined?(DhtSensor) &&
bencc has left #ruby [#ruby]
<kareeoleez>
this is awesome
<kareeoleez>
jhass: thank you.
nankyokusei has quit [Ping timeout: 246 seconds]
<shevy>
hmm
<shevy>
would defined?(DhtSensor) be equivalent to Object.const_defined?(:DhtSensor)
ljames has quit []
banister has joined #ruby
pilne has joined #ruby
craigp has quit [Ping timeout: 244 seconds]
lazaro has joined #ruby
lazaro has quit [Client Quit]
SilverKey has quit [Quit: Halted.]
aegis3121 has joined #ruby
lazaro has joined #ruby
am55 has joined #ruby
lazaro has quit [Client Quit]
<jhass>
shevy: in this case they have the same result, but no, defined? is actually a keyword
ChiefAlexander has quit [Remote host closed the connection]
Vingador_ has joined #ruby
<tribals>
ljarvis: it doesn't work because it is piece of shit, not code. what i asking for is how to implement a parser that supports enumeration on it (`#each`, `#map`, etc), and one line can contain multiple parsed values
bgresham is now known as demophoon
gettalong has joined #ruby
ramfjord has quit [Ping timeout: 272 seconds]
mistermocha has quit [Remote host closed the connection]
mistermocha has joined #ruby
<apeiros>
tribals: if it doesn't work, then you should fix it.
Vingador has quit [Ping timeout: 240 seconds]
<ljarvis>
hehe
<ljarvis>
tribals: you probably want to check out the Enumerable module
<apeiros>
if "you should fix it" sounds like an unspecific useless piece of information, then that's because "it doesn't work" is too
<ljarvis>
that said, there's a bug in your implementation
<tribals>
apieros: i not asking you to fix it
<ljarvis>
but I dont think you'll notice it until you start using enumerable methods
<apeiros>
?tabnick tribals
<ruby[bot]>
tribals: pro-tip - use tab completion for nicks. avoids typos in nicks.
ddffg has joined #ruby
<ljarvis>
ahh good old apieros is back
blaxter has joined #ruby
<apeiros>
"can I yield form[sic] block" - if you mean "can I yield within a block", then yes, you can.
<ljarvis>
my example shows that anyway
<ljarvis>
line 19 has a bug
<ljarvis>
is a bug, rather
blaxter has quit [Client Quit]
<ddffg>
why do i get such error undefined method `beginning_of_day' for #<DateTime:0x00556b918a8570>
<ljarvis>
or it's just silly
<ljarvis>
the line is fine
tomchapin has joined #ruby
<ljarvis>
ddffg: because you didn't require active support
<ddffg>
ruby 2.3.0 and 2.3.1
<ljarvis>
ddffg: it's an active support extension (monkey patch)
Macaveli has joined #ruby
<ljarvis>
require "active_support/date" or something
<ddffg>
what is alternaivity
<ljarvis>
excuse me?
<apeiros>
today's spelloday
<ljarvis>
an alternative?
<tribals>
apeiros: sorry for typo
<ljarvis>
or something about being naive
<tribals>
in your nick
<ddffg>
yes
<ljarvis>
ddffg: well, you can just build a new date object and set the time to 0
xall_ has quit [Ping timeout: 244 seconds]
<ljarvis>
e.g. something like d = Date.today; DateTime.new(d.year, d.month, d.day, 0)
<ljarvis>
i guess
<ljarvis>
>> d = Date.today; DateTime.new(d.year, d.month, d.day, 0)
<ruby[bot]>
ljarvis: # => uninitialized constant Date ...check link for more (https://eval.in/592239)
<nerium>
Is there a gem that makes it possible to get a value from a hash using a query language? I.e ”key1.key2[2]” would result in {key1 => {key2 => [1,2,3]}} => 3
<smathy>
ruby-lang367, the people here are more interested in teaching you how to improve your knowledge of ruby, rather than give you free solutions to your underlying problem.
<Synthead>
ruby-lang367: you probably want to use rest-client and nokogiri
blaxter has quit [Quit: foo]
<Synthead>
ruby-lang367: also, the company list is paginated, so you'll want to account for that
<smathy>
nerium, the dig method.
<Synthead>
ruby-lang367: in chrome/chromium, open the console, go to the network tab, refresh the page, then scroll the results to see what I mean
<smathy>
(assuming 2.3)
<Synthead>
it'll make ajax calls as you scroll with uris of 2/, 3/, 4/, etc
<ruby-lang367>
ok thx
jgt has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
vuoto has joined #ruby
<Synthead>
also, I didn't look at the ajax data, but you might be able to just JSON.parse the payload from that instead of using nokogiri
<nerium>
smathy: That will only work on non nested object, or am I missing something?
ramfjord has quit [Ping timeout: 244 seconds]
the_drow has joined #ruby
<Synthead>
nerium: key1["key2"][2] ?
<Synthead>
nerium: ["key1"]["key2"][2], rather?
<Synthead>
oh I see what you're doing, nevermind
<nerium>
Synthead: I was hoping for a query language :)
norc has joined #ruby
mistermo_ has quit [Remote host closed the connection]
<Synthead>
nerium: what's the use case?
ornerymoose has quit [Ping timeout: 240 seconds]
diegoaguilar has quit [Remote host closed the connection]
<nerium>
I’m trying to select a value from a deep nested hash
<Synthead>
nerium: in a static or dynamic fashion?
<nerium>
This is the key ”.context.dispatcher.stores.PageStore.pages./nrj/latlista.data[1].modules[2].content[0].title”
<nerium>
(just to give you an idea)
<nerium>
Synthead: Not sure what you mean
the_drow has quit [Read error: Connection reset by peer]
<Synthead>
nerium: as in, is the code always going to be (i.e.) "x.y.z", or are you going to be taking user input for this or something?
jgt has quit [Ping timeout: 260 seconds]
<nerium>
Synthead: Aha. Then it’s dynamic
zeroDi has joined #ruby
<Synthead>
nerium: are you going to be using this query-esque language just for your own code, or is it going to be seen in the final product?
the_drow has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
<nerium>
Synthead: final
<adam12>
nerium: You could likely build some sort of proxy or adapter that a) responded to method missing and b) overwrote/defined #[]
<Synthead>
nerium: ah, ok
<adam12>
nerium: I'm not sure I would do something like that tho?
<nerium>
Why not? :)
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<adam12>
nerium: I think the tools Ruby provides for accessing nested hashes is good enough... :)
<Synthead>
nerium: the reason why I'm asking these questions is because it sounds like a bit of code smell over here
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Synthead>
it's custom, so others will not know how to look it up, use it, it would have to be maintained, there might be weird bugs, etc
roamingdog has quit [Remote host closed the connection]
kareeole_ is now known as kareeoleez
<Synthead>
and on the turn of things, it'll likely be slower than standard ruby, and provide limitations (what if the key must have a "." in it?)
<nerium>
I need something that can be expressed on a single line and fail with a proper error message
<Synthead>
I think you're better off using an Array of keys, then using a recursive function with .fetch to dig into the object a bit
<nerium>
True. That’s why I’m asking for an already exiting language
djbkd has quit [Remote host closed the connection]
<nerium>
Then the parser can use it to print propper messages. I.e ”You passed a.b[1].c but a.b is not an array"
djbkd has joined #ruby
craigp has quit [Ping timeout: 260 seconds]
the_drow_ has joined #ruby
<toretore>
nerium: still missing a lot of context here to be able to see the big picture
<nerium>
I might have been a bit unclear. I can something like this my self but was hoping for something already exiting so that I dont have to spend time testing, documenting and fixing small bugs in the code for the next weeks
<nerium>
toretore: I can show you some example usage
<adam12>
nerium: My implementation is 19 lines, unoptimized. I'm not sure I'd want another dependency in place of it.
<nerium>
Without having to implement my own language (like I’ve now)
<nerium>
or is there a better way?
<thegunbuster>
globalall0c various factors. But the biggest I recall is that ruby caught on in popularity later.
<thegunbuster>
There's also performance and closeness to psuedo code, along with standards enforcement (which python does better)
johnmilton has quit [Quit: Namaste]
<nofxx>
I would recommend ruby first, way more clear and well thought globalall0c
<thegunbuster>
by standards enforcement I mean the PEP guidelines
<nerium>
adam12: The problem is that you code isn’t tested or documented – something that takes quite sometime
yardenbar has quit [Ping timeout: 260 seconds]
<nerium>
I’m not saying it’s bad :)
<globalall0c>
nofxx, i program in c and asm
<globalall0c>
my gf, knew to cs, wants to learn ruby
the_drow has quit [Read error: Connection reset by peer]
<globalall0c>
clearly, c && asm != ruby
<thegunbuster>
What do you eventually want to do with ruby?
<lupine>
I'd suggest learning scheme first
<lupine>
HtDP is god
<globalall0c>
thegunbuster, nothing. i want to help her learn
<thegunbuster>
Is it just a language or are you interested in a specific application, like scientific computing, web-dev, simulations etc
<thegunbuster>
oh
<nofxx>
globalall0c, you'll have fun teaching her. Also you'll know both sides of all of this
albedoa has joined #ruby
<nofxx>
globalall0c, asm raw it can gets, ruby the high level smarter it gets
<globalall0c>
nofxx, i also do .net
<toretore>
nerium: there are json query languages like http://goessner.net/articles/JsonPath/ but i probably wouldn't add such a dependency for internal use
<globalall0c>
im insanely biased to low level stuff
<nerium>
toretore: Why?
freerobby has joined #ruby
<globalall0c>
but my gf, being smarter than me, wanted to do high level
the_drow has joined #ruby
<toretore>
nerium: i don't like introducing dependencies when i don't have to
<nofxx>
globalall0c, haha...yeah, I'm ok with ~200 programming an AVR in C... asm NO PLEASE
roamingdog has joined #ruby
<nofxx>
~200~500 lines of C*
<thegunbuster>
ask her again, if she wants to apply the language somewhere specific
<toretore>
nerium: the threshold for added value / cost for me is quite high
<thegunbuster>
ASM is a nightmare to navigate :(
<nofxx>
globalall0c, I remember skipping 8085 classes to drink beer. Don't regret ;)
<nerium>
toretore: Not having to write, test, document, maintain any piece of code is a win (for me)
<thegunbuster>
otherwise, a good resource for ruby is the ruby-koans project
<lupine>
learning a language is muc h less important than learning to program
<lupine>
you can do that in any language, scheme happens to have good resources
<toretore>
nerium: dependencies hide complexity that you don't control
smathy_afk is now known as smathy
<nofxx>
globalall0c, check chris pine learn to program, great and online
<nerium>
toretore: True. Read an aricle about that a few month ago
<globalall0c>
nofxx, im trying to stray away from anything online. i learned from books and hands on, i think online material doesnt teach correctly IMO
<nerium>
I gues that’s something you need to take into considuration
<toretore>
nerium: the alternative is to access your data only using the methods provided on built-in data structures, which is what i would do until it became close to unbearable
dikaio has joined #ruby
<smathy>
nerium, you caught up now re dig?
<thegunbuster>
globalall0c, I learnt with these: http://rubykoans.com/ (Great after an introductory book)
<globalall0c>
thegunbuster, she thinks it clear-er than other languages and she likes the rapid development behind it
<nerium>
toretore: Not sure I understand what you mean
<nerium>
smathy: What?
<nofxx>
globalall0c, that's an ASM concept =D drop it. high lvl langs changes monthly
the_drow has quit [Read error: Connection reset by peer]
<smathy>
nerium, you're clear? I just got back, saw you asked me something about nesting, but you seem to be ok now?
<nofxx>
at least their libs... reuse of code... we call 'gems'
SCHAAP137 has joined #ruby
eGGshke has quit [Quit: Leaving...]
<norc>
globalall0c, no book teaches correctly. Only practice does.
mattwashere has quit [Remote host closed the connection]
<thegunbuster>
I agree about video series, the best way to learn the language is to use it! & maybe read about the caveats
<nofxx>
yup... and up to date material saves times
<nerium>
smathy: Sort of. Do you know any json query language simular to css selectors for ruby?
<globalall0c>
norc, i agree, but when i started ages ago i would read books cover to cover
<globalall0c>
it helped me improve.. A LOT
<norc>
globalall0c, actually writing code and participating on github would have helped you improve... MORE.
<thegunbuster>
But then, I got my hands on turbo-c++
<norc>
globalall0c, Im not saying that books are bad, but actual real world practice is better.
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
symm-_ is now known as symm-
mikecmpbll has joined #ruby
<thegunbuster>
toretore, whoa where?
<smathy>
He was just giving more examples of bad first lines :)
<toretore>
thegunbuster: in all of my repos
<smathy>
My personal favorite `git commit -mWIP` :)
<thegunbuster>
ayy
<norc>
smathy, I use compact git commit messages at work all the time
mattwashere has quit [Remote host closed the connection]
<norc>
"stuff unfucked"
<norc>
It's quite handy.
<toretore>
git commit -m"use git show dumbass"
mattwashere has joined #ruby
<thegunbuster>
I like spam committing and then I squash them all
<adam12>
thegunbuster: I looked over it. Looks good, tho I don't know shit about stats. I noticed you use explicit returns in some places where they aren't needed. Assuming this is for a certain styleguide?
Wsewolod has quit [Quit: Leaving]
DTZUBDUB has joined #ruby
<norc>
squashing is if your colleagues cant handle profanity, in which case I recommend a better job.
<smathy>
git ci -m"squash this"
<thegunbuster>
adam12, Yes it's just a style preference, I come from C so I find it easier to have methods end with a return
<thegunbuster>
Had to fight rubocop for that one
<adam12>
Hah. Yep.
<elomatreb>
squashing also creates gigantic diffs. Hard to scan quickly
<norc>
thegunbuster, do you also declare the return type for every method?
kirun has joined #ruby
<thegunbuster>
I try to as much as possible in the yardoc comments
<norc>
thegunbuster, honestly rubocop is misused for the most part.
crank1988 has quit [Ping timeout: 252 seconds]
<norc>
thegunbuster, the only thing I use it for is converting the random "" to '' strings.
<thegunbuster>
and trimming trailing WS :D
<norc>
thegunbuster, both vi and git will cry if I have trailing WS.
<thegunbuster>
I'm coding from c9.io
<thegunbuster>
my laptop is finally potato
<marahin>
How can I define a method, that would react to this: a = Model.new; a('argument')?
<toretore>
you can't
<marahin>
really?
<toretore>
no
<adam12>
marahin: use case
<adam12>
?
KCmetro has quit [Remote host closed the connection]
<thegunbuster>
a is a Model object. You pass data to a method
moeabdol has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
<marahin>
uh-huh
<thegunbuster>
unless you define the () method for a
KCmetro has joined #ruby
<marahin>
adam12, I just wanted to learn really, if that's possible or not :)
<thegunbuster>
which you can't IIRC (restricted by ruby)
<elomatreb>
Are you coming from PHP? __invoke() was a mistake
<marahin>
thegunbuster, and defining such method is impossible, yes?
<marahin>
elomatreb, not at all :P
<marahin>
thegunbuster, that's what I wanted to know
<thegunbuster>
you can try def self.[](*args); # something; end
<marahin>
thank you guys.
<thegunbuster>
square brackets are the only exception to this rule
<adam12>
marahin: Some people will (ab)use [] to achieve similiar results.
<thegunbuster>
(like me)
<adam12>
Sequel is a great example of this, which is done well.
<Mon_Ouie>
You can also do foo.(argument) which is a special syntax to call the #call method
crank1988 has joined #ruby
<thegunbuster>
Ha, didn't know that #call can be done that way too
craigp_ has quit [Ping timeout: 272 seconds]
<thegunbuster>
adam12, anything else you'd like to add? Like specific features that you expect from a stats library?
<adam12>
thegunbuster: tbh, not super familiar with stats, so I'd probably defer any answer.
<thegunbuster>
All I planned right now is RNGs, Distributions and a Hypothesis (A-B testing) module
moei has quit [Quit: Leaving...]
karmatr0n has joined #ruby
<thegunbuster>
Got it.
moeabdol has quit [Ping timeout: 252 seconds]
Spami has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
KCmetro has quit [Remote host closed the connection]
KCmetro has joined #ruby
Eiam has quit [Quit: ╯°□°)╯︵ǝpouǝǝɹɟ]
moei has joined #ruby
hahuang62 has joined #ruby
codecop has joined #ruby
joonty has joined #ruby
mattwashere has quit [Remote host closed the connection]
albedoa has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mattwashere has joined #ruby
ta_ has joined #ruby
madgen has joined #ruby
rkazak has joined #ruby
maucar has quit [Quit: Leaving]
mattwashere has quit [Remote host closed the connection]
cdg has quit [Ping timeout: 252 seconds]
mynameisbrian has joined #ruby
<mynameisbrian>
is it uncommon to have an instance attribute as an array?
skade has joined #ruby
<mynameisbrian>
I wanted to do: obj.prop = 'hello' and then 'hello' gets pushed onto the array
<smathy>
Only when something else would make more sense.
<mynameisbrian>
what about that setter syntax? Or is a method to add onto the array more common?
yfeldblum has joined #ruby
<mynameisbrian>
because then there would be no way to delete, and so I would have to provide a method for this
<smathy>
Overriding `prop=` to mean `prop <<` is a terrible API cludge.
mshowman_ has joined #ruby
<mynameisbrian>
I have a list of folders I want to generate, so I'm just trying to think of the best way to store the folder names
spudowiar has quit [Read error: No route to host]
ramfjord has joined #ruby
mshowman has quit [Ping timeout: 264 seconds]
mattwashere has joined #ruby
YaknotiS has quit [Remote host closed the connection]
troulouliou_dev has joined #ruby
YaknotiS has joined #ruby
mooru has quit [Ping timeout: 260 seconds]
spudowiar has joined #ruby
Wixy has joined #ruby
Mattx has quit [Disconnected by services]
Wixy is now known as Mattx
johnmilton has joined #ruby
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blackmes1 has quit [Quit: WeeChat 1.5]
gfvcastro has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
rkazak has quit [Ping timeout: 272 seconds]
SilverKey has quit [Read error: Connection reset by peer]
dikaio has joined #ruby
wrkrcoop has quit [Quit: wrkrcoop]
yardenbar has joined #ruby
RegulationD has quit [Remote host closed the connection]
SilverKey has joined #ruby
ebbflowgo has quit [Read error: Connection reset by peer]
mattwashere has quit [Remote host closed the connection]
Tachikomas has joined #ruby
ebbflowgo has joined #ruby
gfvcastro has quit [Client Quit]
albedoa has joined #ruby
mattwashere has joined #ruby
karmatr0n has quit [Ping timeout: 264 seconds]
roamingdog has quit [Remote host closed the connection]
moeabdol has joined #ruby
roamingdog has joined #ruby
cdg has joined #ruby
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
<imperator>
jhass, thanks
dikaio has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Tachikomas has quit [Remote host closed the connection]
ruby[bot] has quit [Remote host closed the connection]
Macaveli has joined #ruby
joonty has quit [Quit: This computer has gone to sleep]
ruby[bot] has joined #ruby
roamingd_ has joined #ruby
roamingdog has quit [Read error: Connection reset by peer]
schuuu has quit [Quit: Leaving.]
bmurt has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
moeabdol has quit [Ping timeout: 276 seconds]
jaguarmagenta has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
roamingd_ has quit [Read error: Connection reset by peer]
mistermo_ has joined #ruby
mynameisbrian has quit [Quit: Page closed]
roamingdog has joined #ruby
eljimbo has quit [Quit: This computer has gone to sleep]
blackgoat has joined #ruby
joonty has joined #ruby
fmcgeough has quit [Quit: fmcgeough]
Moosashi has joined #ruby
jaguarmagenta has quit [Ping timeout: 276 seconds]
spiette has quit [Ping timeout: 244 seconds]
bmurt has joined #ruby
dionysus69 has quit [Remote host closed the connection]
craigp_ has joined #ruby
dionysus69 has joined #ruby
SilverKey has quit [Quit: Halted.]
chip_ has quit [Ping timeout: 260 seconds]
codecop has quit [Remote host closed the connection]
spiette has joined #ruby
yardenbar has quit [Ping timeout: 276 seconds]
Rickmast_ has quit [Ping timeout: 246 seconds]
blaxter has joined #ruby
blaxter has quit [Client Quit]
RegulationD has joined #ruby
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Rickmasta has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
evansbee has joined #ruby
solars has quit [Ping timeout: 244 seconds]
johnmilton has quit [Ping timeout: 264 seconds]
diegoaguilar has joined #ruby
ornerymoose has joined #ruby
synthroid has quit []
snebel has joined #ruby
jgt has joined #ruby
<albedoa>
[['a', 1], ['b', 2], ['c', 3]] <— how do i isolate the first elements (['a', 'b', 'c'] or 'abc' for instance)?
ornerymoose has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
evansbee has quit [Ping timeout: 252 seconds]
swills has quit [Ping timeout: 240 seconds]
ornerymoose has joined #ruby
blackgoat has quit [Quit: WeeChat 1.5]
<snebel>
Hi, may be a silly question.. anyway I'm looking for a mechanism to checkout some ruby version and gemfile and have rvm taking that config by default
<snebel>
I'm playing right now with .ruby-version and .ruby-gemset
<snebel>
but is not working
blackgoat has joined #ruby
<snebel>
just created both files in an empty folder..
<snebel>
i do ruby --version and nothing the default version is shown..
Moosashi has quit [Quit: Moosashi]
jgt has quit [Ping timeout: 244 seconds]
<snebel>
instead of the one that is specifiec on the ruby-version file
noodle has quit [Quit: /quit]
jenrzzz has quit [Ping timeout: 264 seconds]
<Mon_Ouie>
albedoa: map(&:first)
<tobiasvl>
was just going to suggest the same but with collect
<albedoa>
Mon_Ouie thank you
ecksit has joined #ruby
Moosashi has joined #ruby
minimalism has joined #ruby
ChiefAlexander has quit [Remote host closed the connection]
johnmilton has joined #ruby
mattwashere has quit [Remote host closed the connection]
<Mon_Ouie>
albedoa: That proc actually gets called with only one argument, which happens to be an array. That |k, v| syntax, which makes it look like there are two arguments, extracts the first and second element from the array.
<norc>
scorphus, expect(ary).to include(1) ?
mwlang has joined #ruby
<norc>
scorphus, note that it works on any object that responds to #include?
<scorphus>
quite that, norc, but the other way around
<albedoa>
Mon_Ouie gotcha, thanks. now i understand why my solution worked :D
<norc>
scorphus, what do you mean?
<scorphus>
so it should read expect([opt1, opt2, opt3) to include testing_method("test_string")
<scorphus>
I mean, testing_method is the one method I'm writing this test for
<scorphus>
s/opt3/opt3]/ sorry
<norc>
scorphus, you can simply use enumerable
<norc>
scorphus, mmm
rodfersou has quit [Quit: leaving]
<norc>
scorphus, you dont have to put the subject into the expect()