havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.1, 2.3.4 & 2.2.7: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
vondruch has quit [Client Quit]
vondruch has joined #ruby
conta has quit [Ping timeout: 240 seconds]
xuanrui has quit [Quit: Leaving]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
matti has joined #ruby
Rodya_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
hahuang61 has joined #ruby
milardovich has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rodya_ has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 248 seconds]
ta_ has joined #ruby
gregf_ has quit [Ping timeout: 260 seconds]
ta_ has quit [Ping timeout: 240 seconds]
Derperperd has quit [Changing host]
Derperperd has joined #ruby
madgen has quit [Ping timeout: 240 seconds]
xco has joined #ruby
<xco> can someone help me turn this curl to Ruby code? https://gist.github.com/xcobar/7adc8cf5faf713546d70a12139de7328
astrobun_ has joined #ruby
vondruch has quit [Quit: vondruch]
<havenwood> xco: yes, one sec
vondruch has joined #ruby
PaulCapestany has quit [Quit: .]
marr has quit [Ping timeout: 240 seconds]
MarkBilk_ has joined #ruby
<xco> havenwood: thanks. in the mean time i tried this https://gist.github.com/xcobar/7adc8cf5faf713546d70a12139de7328#file-tried-rb
PaulCapestany has joined #ruby
alex`` has quit [Ping timeout: 240 seconds]
<havenwood> xco: What failed with your try?
<xco> havenwood: i pasted the error too in the gist
<havenwood> (getaddrinfo: nodename nor servname provided, or not known) (SocketError)
<havenwood> mm
MarkBilk has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<havenwood> xco: I get: response.code #=> "403"
<havenwood> (Without exporting $API_KEY and $API_SECRET.)
dstrunk has joined #ruby
Cohedrin_ has joined #ruby
<xco> havenwood: works for me. studying what i did wrong. thanks :)
<darix> .oO( system("curl ...") )o
Rodya_ has joined #ruby
<xco> darix: that will work but i don’t want those download stats in my console
<darix> xco: curl -sS
vondruch has quit [Client Quit]
vondruch has joined #ruby
minimalism has joined #ruby
Rodya_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
AndBobsYourUncle has joined #ruby
_whitelogger has joined #ruby
ResidentBiscuit has quit []
<xco> darix: thanks :)
lasey has quit [Ping timeout: 248 seconds]
<xco> havenwood: on this line https://gist.github.com/havenwood/e516788b28a6e2f315017bfd35a7a237#file-xco-rb-L8 how do i store my ENV['API_KEY'] locally? is it possible?
lasey has joined #ruby
<elomatreb> xco: "store locally"? As in storing it in a file?
<xco> yup
<xco> but it’s something i want to push to GH and i don’t want to push my keys
<elomatreb> Ah. What I usually do is use a YAML file, you can then just require "yaml" and do YAML.safe_load("path/to/file")
AlexRussia has quit [Quit: WeeChat 1.9]
kn-928 has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
eckhardt has joined #ruby
bronson has joined #ruby
<xco> elomatreb: awesome!
gizmore|2 has joined #ruby
kn-928 has quit [Ping timeout: 255 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gizmore has quit [Ping timeout: 255 seconds]
bronson has quit [Ping timeout: 240 seconds]
eckhardt has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
eckhardt has quit [Client Quit]
eckhardt has joined #ruby
eckhardt has quit [Client Quit]
<xco> how to i have line 1 download into a folder? currently this is downloading a file into the same folder where the ruby file is found. i want to put the file in a subfolder https://gist.github.com/xcobar/f5110ade35839c7481f1f92e20325cf3#file-dl-rb-L1
<xco> i can’t use /folder/name_of_file not sure if i’m doing it right
<bitflipper> @zenspider "Use assert_nil if expecting nil" - why? i agree that assert_nil is a nicer assertion, but shouldn't `assert_equal nil, foo.bar` always work?
eckhardt has joined #ruby
<bitflipper> deprecation message in minitest btw
<elomatreb> xco: If your path starts with / it's an absolute path, so it'd try to put in somewhere near the root direcory, where you either don't have permission or the folder doesn't exist (or both)
<xco> elomatreb: what if i don’t want to put it in the root directory? I actually want to put in a subfolder in which that ruby file is found
<elomatreb> Just leave off the leading slash, then it'd be a relative path. But all folders have to exist, it won't automatically create them
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xco> elomatreb: thiis is what i did: File.open(__dir__ + "/" + "downloaded_images/" + "getty_images#{ image_id_num.to_s }.jpg","wb") do |file|
selim has quit [Ping timeout: 240 seconds]
<elomatreb> (Nitpick: Calling .to_s on something in #{} is superflous, it does that automatically for you)
<xco> oh good catch
selim has joined #ruby
vondruch has quit [Quit: vondruch]
milardovich has quit [Remote host closed the connection]
harai has joined #ruby
vondruch has joined #ruby
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
vondruch has quit [Client Quit]
herbmillerjr has quit [Quit: Konversation terminated!]
vondruch has joined #ruby
harai has quit [Ping timeout: 255 seconds]
xco has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
nacsurte_ has quit [Ping timeout: 255 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
nacsurte has joined #ruby
dymaxion_ has joined #ruby
herbmillerjr has joined #ruby
jgt1 has quit [Ping timeout: 248 seconds]
ahrs has quit [Remote host closed the connection]
nacsurte has quit [Ping timeout: 248 seconds]
dymaxion_ has quit [Ping timeout: 248 seconds]
s3nd1v0g1us has quit [Quit: tempusfugit]
ahrs has joined #ruby
s3nd1v0g1us has joined #ruby
s3nd1v0g1us has quit [Max SendQ exceeded]
s3nd1v0g1us has joined #ruby
beilabs has joined #ruby
ryanf has joined #ruby
ryanf has quit [Client Quit]
xco has joined #ruby
nacsurte has joined #ruby
hahuang61 has joined #ruby
cadillac_ has quit [Ping timeout: 240 seconds]
cadillac_ has joined #ruby
ramfjord has joined #ruby
beilabs has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 240 seconds]
dymaxion_ has joined #ruby
charliesome has joined #ruby
kculpis has joined #ruby
Defenestrate has joined #ruby
spheric has quit [Ping timeout: 255 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<xco> i want to “mimic” the effect of a progress bar using a string of “#”. how do i add extrs “#” on THE SAME line?
mark_on_the_moon has joined #ruby
harfangk has joined #ruby
apparition47 has joined #ruby
milardovich has quit []
dymaxion_ has quit [Ping timeout: 240 seconds]
<synstack> xco: print instead of puts, then end the line with a "\n"
<elomatreb> Alternatively you can play around with ending the line with \r, if the terminal supports it you can "reprint" a line
nadir has joined #ruby
eljimmy has joined #ruby
harai has joined #ruby
<havenwood> %w[/ - \\ |].cycle.each { |char| print char, "\r"; sleep 0.5 }
<havenwood> I guess the #each is redundant there.
<havenwood> %w[/ - \\ |].cycle { |char| print char, "\r"; sleep 0.5 }
<havenwood> %w[#].cycle { |octothorpe| print octothorpe; sleep 1 }
<havenwood> more reasonably: loop { print '#'; sleep 1 }
dymaxion_ has joined #ruby
jameser has joined #ruby
cadillac_ has quit [Quit: I quit]
<havenwood> [128073, 128071, 128072, 128070].pack('U*').each_char.cycle { |finger| print finger, "\r"; sleep 1 }
quobo has quit [Quit: Connection closed for inactivity]
dymaxion_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
dymaxion_ has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
dymaxion_ has quit [Client Quit]
bronson has joined #ruby
jgt1 has joined #ruby
beilabs has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
dcunit3d has joined #ruby
dcunit3d has quit [Client Quit]
dcunit3d has joined #ruby
dcunit3d has quit [Client Quit]
kn-928 has joined #ruby
dcunit3d has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kn-928 has quit [Ping timeout: 240 seconds]
im314ous has joined #ruby
nobitanobi has joined #ruby
blznblzn2 has joined #ruby
<xco> what’ll be another way for me to do this (1..10).each {}
<xco> that is looping over 10 times?
<xco> x.times do
gix has quit [Ping timeout: 255 seconds]
nobitanobi has quit [Remote host closed the connection]
<elomatreb> .times starts on 0, you could do `1.upto(1) {}`, but I'm not sure if that's better than using the range like that
<havenwood> xco: I think it's pretty to: 1.upto(10) { |n| ... }
<havenwood> xco: Or when the range is open-ended: 1.step { |n| ... }
gix has joined #ruby
<havenwood> >> 1.step.lazy.map { |n| n ** n }.first 7
<ruby[bot]> havenwood: # => [1, 4, 27, 256, 3125, 46656, 823543] (https://eval.in/847689)
tw1sted has quit [Remote host closed the connection]
tw1sted has joined #ruby
tom has joined #ruby
<havenwood> xco: Another less-used option for your initial question is: 1.step(to: 10) { |n| ... }
tom is now known as Guest94732
<havenwood> 1.upto(10) is nicer
jackjackdripper has joined #ruby
Guest94732 is now known as yask
yask is now known as sdjlasjdkyask
<xco> awesome. thanks :)
jameser has joined #ruby
tw1sted has quit [Remote host closed the connection]
tw1sted has joined #ruby
AndBobsYourUncle has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
govg has joined #ruby
iamyask has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang61 has joined #ruby
jameser has joined #ruby
apparition47 has quit [Quit: Bye]
<nofxxx> havenwood, is #first N new ?
<nofxxx> or I totally missed it
<havenwood> nofxxx: Nope, it's not new. They did more recently add n for #min_by and #max_by.
hahuang61 has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
ta_ has joined #ruby
vondruch has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has quit [Quit: WeeChat 1.9]
nobitanobi has joined #ruby
vondruch has quit [Client Quit]
ta_ has quit [Ping timeout: 248 seconds]
vondruch has joined #ruby
xco has quit [Quit: xco]
runescape07rsps has joined #ruby
dcunit3d has quit [Quit: WeeChat 1.4]
ecuanaso has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
im314ous has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Client Quit]
vondruch has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<iamyask> uumm, I have a simple rails question
<ruby[bot]> iamyask: we in #ruby do not like irccloud.com, I reposted your paste to gist for you: https://gist.github.com/7ba7fa2aecffbfee7e9349d486aa2433
<ruby[bot]> iamyask: irccloud.com has no syntax highlighting, distracting formatting and loads slowly for most.
<iamyask> Is it okay to use exception like this? ^
jgt1 has quit [Ping timeout: 240 seconds]
<elomatreb> iamyask: It's usually considered bad practice to use exceptions for flow control. If you can avoid them, do so
jgt1 has joined #ruby
_whitelogger has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<bitflipper> iamyask: it depends. i don't think exceptions are free in comparison to checking for the presence of `nil`/`false`. it also depends what `Foo.alert` is raising an exception for. did it encounter some sort of fatal error? then it seems fine.
bkxd has joined #ruby
<bitflipper> ah. `flash[:error] = e.message` doesn't seem like a good idea. they're not usually user-facing messages, and more diffilcult to translate them if you support >1 lang
vondruch has quit [Client Quit]
vondruch has joined #ruby
<bitflipper> flash[:error] = I18n.t(e.localeKey) might work tho. if you go down that road.
<bitflipper> sry
<bitflipper> e.locale_key
bronson has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
nobitanobi has quit [Remote host closed the connection]
bronson has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
_whitelogger has joined #ruby
spheric has joined #ruby
ltem has joined #ruby
kapil___ has joined #ruby
_whitelogger has joined #ruby
jamesaxl has joined #ruby
hahuang61 has joined #ruby
_whitelogger has joined #ruby
dymaxion_ has joined #ruby
jinie has quit [Read error: Connection reset by peer]
Defenestrate has quit [Quit: Leaving]
dymaxion_ has quit [Ping timeout: 248 seconds]
bruno- has quit [Read error: Connection reset by peer]
bruno- has joined #ruby
jinie has joined #ruby
alex`` has joined #ruby
uZiel has joined #ruby
sdjlasjdkyask has quit [Quit: Connection closed for inactivity]
lasey has quit [Ping timeout: 240 seconds]
lasey has joined #ruby
ptx0 has quit [Quit: Reconnecting]
gixxer1k has joined #ruby
mark_on_the_moon has quit [Remote host closed the connection]
ptx0 has joined #ruby
nofxxxx has joined #ruby
nofxxx has quit [Ping timeout: 240 seconds]
runescape07rsps has quit [Ping timeout: 248 seconds]
harai has quit [Ping timeout: 248 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
Cohedrin_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Cohedrin_ has joined #ruby
Dimik has quit [Ping timeout: 240 seconds]
_asqrd has joined #ruby
ryzokuken has joined #ruby
ryzokuken has quit [Remote host closed the connection]
_asqrd has quit [Quit: Leaving]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
hahuang61 has joined #ruby
kn-928 has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
jordanm has joined #ruby
hahuang61 has quit [Ping timeout: 240 seconds]
kn-928 has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
arvindsaik has quit [Ping timeout: 246 seconds]
bkxd has joined #ruby
arvindsaik has joined #ruby
bkxd has quit [Read error: Connection reset by peer]
bkxd has joined #ruby
jameser has joined #ruby
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
jamesaxl has quit [Read error: Connection reset by peer]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jamesaxl has joined #ruby
enterprisey has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #ruby
harai has joined #ruby
nhhc_ has joined #ruby
nhhc has joined #ruby
nhhc_ has quit [Read error: Connection reset by peer]
bkxd has quit [Ping timeout: 248 seconds]
gixxer1k has quit [Ping timeout: 248 seconds]
gusrub has joined #ruby
vondruch has quit [Quit: vondruch]
ramfjord has joined #ruby
vondruch has joined #ruby
bronson has joined #ruby
kies has joined #ruby
bkxd has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
bronson has quit [Ping timeout: 255 seconds]
scottj has quit [Quit: leaving]
gusrub has quit [Remote host closed the connection]
ta_ has joined #ruby
Defenestrate has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
gusrub has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
Defenestrate has quit [Quit: Leaving]
Defenestrate has joined #ruby
gusrub has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Defenestrate has quit [Quit: Leaving]
kn-928 has joined #ruby
kn-928 has quit [Ping timeout: 240 seconds]
gixxer1k has joined #ruby
gusrub has joined #ruby
enterprisey has quit [Quit: Leaving]
vondruch has quit [Quit: vondruch]
gusrub has quit [Remote host closed the connection]
vondruch has joined #ruby
Cohedrin_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rippa has joined #ruby
_main_ has joined #ruby
vondruch has quit [Quit: vondruch]
_main_ has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
__main__ has quit [Read error: No route to host]
_main_ has joined #ruby
_main_ has quit [Read error: Connection reset by peer]
__main__ has joined #ruby
conta has joined #ruby
biberu has joined #ruby
vondruch has quit [Quit: vondruch]
DoubleMalt has joined #ruby
vondruch has joined #ruby
hanmac has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
hanmac has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
kies has quit [Ping timeout: 240 seconds]
beilabs has quit [Remote host closed the connection]
hahuang61 has joined #ruby
hahuang61 has quit [Ping timeout: 255 seconds]
high_fiver has joined #ruby
sameerynho has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
madgen has joined #ruby
naftilos76 has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
marr has joined #ruby
Paraxial has quit [Read error: Connection reset by peer]
MrBusiness has quit [Ping timeout: 246 seconds]
alex``` has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
itat has joined #ruby
bronson has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
Paraxial has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
bronson has quit [Ping timeout: 276 seconds]
jamesaxl has quit [Read error: Connection reset by peer]
mikecmpbll has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
zapata has quit [Ping timeout: 240 seconds]
DTZUZO has joined #ruby
eljimmy has quit [Quit: This computer has gone to sleep]
dymaxion_ has joined #ruby
gixxer1k has quit [Ping timeout: 248 seconds]
alex``` has quit [Quit: WeeChat 1.9]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dymaxion_ has quit [Client Quit]
harai has quit [Ping timeout: 240 seconds]
TomyLobo has joined #ruby
dymaxion_ has joined #ruby
FastJack has quit [Read error: Connection reset by peer]
jameser has joined #ruby
Tempesta has quit [Quit: See ya!]
FastJack has joined #ruby
minimalism has quit [Quit: minimalism]
zapata has joined #ruby
dymaxion_ has quit [Client Quit]
uZiel has quit [Ping timeout: 268 seconds]
FastJack has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
dymaxion_ has joined #ruby
jamesaxl has joined #ruby
dymaxion_ has quit [Client Quit]
vondruch has quit [Client Quit]
vondruch has joined #ruby
madgen has quit [Ping timeout: 240 seconds]
raynold has quit [Quit: Connection closed for inactivity]
jamesaxl has quit [Read error: Connection reset by peer]
jameser_ has joined #ruby
jamesaxl has joined #ruby
jameser has quit [Ping timeout: 248 seconds]
Cohedrin_ has joined #ruby
Cohedrin_ has quit [Client Quit]
charliesome has joined #ruby
tvw has joined #ruby
FastJack has joined #ruby
tvw has quit [Client Quit]
gixxer1k has joined #ruby
jgt1 has quit [Ping timeout: 255 seconds]
konsolebox has quit [Ping timeout: 240 seconds]
madgen has joined #ruby
konsolebox has joined #ruby
lasey has quit [Ping timeout: 240 seconds]
lasey has joined #ruby
davic has joined #ruby
Tempesta has joined #ruby
jgt1 has joined #ruby
dymaxion_ has joined #ruby
dymaxion_ has quit [Client Quit]
ta_ has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ta_ has quit [Ping timeout: 240 seconds]
jameser_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
jameser has quit [Client Quit]
kapil___ has joined #ruby
Guest22828 has quit [Read error: Connection reset by peer]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jameser has joined #ruby
hahuang61 has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
lasey has quit [Ping timeout: 240 seconds]
harfangk has quit [Ping timeout: 240 seconds]
lasey has joined #ruby
dymaxion_ has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang61 has quit [Ping timeout: 255 seconds]
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #ruby
xco has joined #ruby
xco has quit [Read error: Connection reset by peer]
xco has joined #ruby
Defenestrate has joined #ruby
aspiers has quit [Ping timeout: 240 seconds]
lupine has quit [Ping timeout: 255 seconds]
aspiers has joined #ruby
harfangk has joined #ruby
quobo has joined #ruby
lupine has joined #ruby
kristofferR has joined #ruby
madgen has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
dymaxion_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jameser has quit [Client Quit]
vondruch has quit [Client Quit]
vondruch has joined #ruby
dymaxion_ has joined #ruby
madgen has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
bronson has joined #ruby
biberu has quit []
sepp2k has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
olspookishmagus has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
dymaxion_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jgt1 has quit [Ping timeout: 248 seconds]
xco has quit [Quit: xco]
vondruch has quit [Quit: vondruch]
biberu has joined #ruby
vondruch has joined #ruby
uZiel has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
karthick has joined #ruby
harfangk has quit [Quit: No Ping reply in 180 seconds.]
harfangk has joined #ruby
naftilos76 has quit [Quit: Αποχώρησε]
madgen has quit [Quit: Lost terminal]
lasey has quit [Ping timeout: 240 seconds]
lasey has joined #ruby
t-recx has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
MrBusiness has joined #ruby
karthick has quit [Ping timeout: 255 seconds]
runescape07rsps has joined #ruby
vondruch has quit [Quit: vondruch]
mikecmpbll has quit [Quit: inabit. zz.]
vondruch has joined #ruby
jameser has joined #ruby
Puffball has quit [Ping timeout: 255 seconds]
xco has joined #ruby
DaniG2k has joined #ruby
weaksauce has quit [Read error: Connection reset by peer]
dymaxion_ has joined #ruby
itat has quit [Ping timeout: 246 seconds]
ta_ has joined #ruby
TomyLobo has quit [Ping timeout: 255 seconds]
ta_ has quit [Ping timeout: 240 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
hahuang61 has joined #ruby
Puffball has joined #ruby
hahuang61 has quit [Ping timeout: 240 seconds]
dymaxion_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rrode has joined #ruby
dymaxion_ has joined #ruby
chouhoulis has joined #ruby
apparition47 has joined #ruby
bkxd has quit [Ping timeout: 255 seconds]
dymaxion_ has quit [Quit: Textual IRC Client: www.textualapp.com]
SqREL has joined #ruby
conta has quit [Quit: conta]
VladGh has quit [Ping timeout: 240 seconds]
SqREL has quit [Ping timeout: 240 seconds]
sylario has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
nopolitica has joined #ruby
Fysicus has joined #ruby
bronson has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
rrode has quit [Ping timeout: 240 seconds]
bronson has quit [Ping timeout: 255 seconds]
jgt1 has joined #ruby
VladGh has joined #ruby
conta has joined #ruby
bkxd has joined #ruby
vondruch has quit [Quit: vondruch]
jgt1 has quit [Ping timeout: 248 seconds]
vondruch has joined #ruby
rrode has joined #ruby
conta has quit [Ping timeout: 248 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
sneep has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 248 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
FysiWRK has joined #ruby
Fysicus has quit [Ping timeout: 246 seconds]
bruno- has quit [Ping timeout: 240 seconds]
harfangk has quit [Ping timeout: 240 seconds]
govg has joined #ruby
Ishido has joined #ruby
vondruch has quit [Quit: vondruch]
beilabs has joined #ruby
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
harfangk has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
segy has quit [Quit: ZNC - http://znc.in]
<jonh> is there a recommended tool for creating new ruby projects?
<havenwood> jonh: Do you mean apps or gems or both?
vondruch has quit [Client Quit]
vondruch has joined #ruby
<jonh> apps since i'm pretty new, but knowledge of both would be good since i'll eventually make gem
<bitflipper> `bundle gem foo` works okay for creating new libraries/gems and even cmd line tools
<havenwood> jonh: For apps it'll depend on the framework.
gixxer1k has quit [Ping timeout: 246 seconds]
<iamyask> hey, I was wondering if its okay to use exception in controllers like this:
<bitflipper> we answered iamyask
<iamyask> begin
<iamyask> ensure
<iamyask> flash[:error] = e.message
<iamyask> rescue e
<iamyask> flash[:success] = Alert.foo
<iamyask> redirect_to :back
<bitflipper> it's been answered
<iamyask> Ah! Sorry, i can't see the message :/
<havenwood> iamyask: Please use a gist for more than three lines.
segy has joined #ruby
<bitflipper> iamyask: it depends. i don't think exceptions are free in comparison to checking for the presence of `nil`/`false`. it also depends what `Foo.alert` is raising an exception for. did it encounter some sort of fatal error? then it seems fine.
<bitflipper> ah. `flash[:error] = e.message` doesn't seem like a good idea. they're not usually user-facing messages, and more diffilcult to translate them if you support >1 lang
<bitflipper> flash[:error] = I18n.t(e.localeKey) might work tho. if you go down that road.
<thinkpad> ruby was created by a nice japanese fellow
<bitflipper> sry, e.locale_key
<bitflipper> 6:00 AM E<elomatreb> iamyask: It's usually considered bad practice to use exceptions for flow control. If you can avoid them, do so
<bitflipper> also
<havenwood> jonh: I'd personally recommend creating a simple Rack app. Then convert it to a Roda app and try a few plugins.
<havenwood> jonh: Rails has the most popular app generators.
<thinkpad> japanese folks take great pride in their creations, you know
<jonh> havenwood: thanks i'll look into those
<iamyask> Thanks @bitflipper! That makes sense.
<havenwood> jonh: Most Ruby webapps are Rack apps of one sort or another.
<havenwood> jonh: So it's nice to know how to make a simple pure Rack app.
<havenwood> jonh: Here's an example "Hello World" in a couple dozen varied Rack frameworks: https://github.com/luislavena/bench-micro/tree/master/apps
<havenwood> jonh: https://rack.github.io/
<jonh> thanks i was just going to ask if you knew any simple projects examples
<jonh> ahead of the game :)
Fysicus has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
Defenestrate has quit [Quit: Leaving]
jgt1 has joined #ruby
bitflipper is now known as pinksandles
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
enterprisey has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
rgr has joined #ruby
vondruch has quit [Client Quit]
harfangk has quit [Ping timeout: 255 seconds]
vondruch has joined #ruby
hahuang61 has joined #ruby
marr has quit [Ping timeout: 248 seconds]
hahuang61 has quit [Ping timeout: 240 seconds]
xco has quit [Read error: Connection reset by peer]
xco has joined #ruby
im314ous has joined #ruby
chouhoulis has quit [Remote host closed the connection]
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
<iamyask> silly question, but can someone explain what proc is ?
enterprisey has quit [Remote host closed the connection]
<apeiros> iamyask: a piece of code which can be stored in a variable and executed whenever
<pinksandles> yeah.. doc description is better than that
<pinksandles> Proc objects are blocks of code that have been bound to a set of local variables. Once bound, the code may be called in different contexts and still access those variables.
<iamyask> That makes sense! Thanks apeiros and pinksandles :)
jinie has quit [Read error: Connection reset by peer]
Mon_Ouie has joined #ruby
<pinksandles> ur welcome
jinie has joined #ruby
SqREL has joined #ruby
vondruch has quit [Quit: vondruch]
quobo has quit [Quit: Connection closed for inactivity]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
DaniG2k has quit [Quit: leaving]
howdoi has joined #ruby
gixxer1k has joined #ruby
bronson has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
ahrs has quit [Remote host closed the connection]
bronson has quit [Ping timeout: 240 seconds]
vondruch has quit [Client Quit]
ahrs has joined #ruby
Dimik has joined #ruby
apparition47 has quit [Quit: Bye]
vondruch has joined #ruby
FysiWRK has quit [Ping timeout: 248 seconds]
Fysicus has quit [Ping timeout: 240 seconds]
kalidor has left #ruby ["WeeChat 1.4"]
nhhc has quit [Quit: Leaving]
segy has quit [Quit: ZNC - http://znc.in]
quobo has joined #ruby
segy has joined #ruby
astrobun_ has quit [Remote host closed the connection]
xco has quit [Quit: xco]
<iamyask> what does it mean to pass variables to the function with `:` appended to it?
<iamyask> eg: ```
<iamyask> ```
<iamyask> foo(batch:, resolution_details:, user:, ignore_until:)
<iamyask> ```
<iamyask> ```
<iamyask> end
<iamyask> ...
<iamyask> def foo(batch:, resolution_details:, user:, ignore_until:)
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<apeiros> it means it's not a variable
<apeiros> `foo: bar` is short hand for `{:foo => bar}`
<apeiros> and when you pass it to a method (not function), it's usually keyword arguments (instead of positional arguments)
<bougyman> they're keyword arguments.
<bougyman> yes, what he said.
vondruch has quit [Client Quit]
vondruch has joined #ruby
jgt2 has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jgt1 has quit [Ping timeout: 240 seconds]
<iamyask> I see. Thanks! btw when you said "when you pass it to a method (not function)", whats the difference b/w these two?
<iamyask> apeiros: ^
vondruch has quit [Client Quit]
vondruch has joined #ruby
<apeiros> ruby doesn't really have functions. functions are without a concept of "self". methods belong to an object, the receiver, which is accessible via self.
nobitanobi has joined #ruby
chouhoulis has joined #ruby
<apeiros> procs/blocks are what come clostest to functions in ruby. but since they are more than functions, I wouldn't use that term for them either
<iamyask> Aha! What about class methods ?
<apeiros> what about them?
<apeiros> their self is the class
<iamyask> They are neither Procs or Method(since they don't belong to a particular object)
<apeiros> you can try it
<apeiros> class Foo; def self.class_method; p my_self_is: self; end; end
<apeiros> Foo.class_method
<apeiros> they are methods, as said, they belong to the class
<apeiros> classes are objects ;-)
jhass has quit [Ping timeout: 240 seconds]
<iamyask> Cool! Thanks! it
<iamyask> *its a bit confusing, is there any blog/link which you can recommend for more reading on this?
Mon_Ouie has quit [Ping timeout: 240 seconds]
nobitanobi has quit [Remote host closed the connection]
jhass has joined #ruby
ta_ has joined #ruby
SR__Sebastian has joined #ruby
alfiemax has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
DoubleMalt has quit [Ping timeout: 276 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<SR__Sebastian> Hello there! I am quite new to Ruby and made an IMAP script. I can log in and also to catch an exception If the login fails. However I want to know if I can´t login because I mistyped my password or if e.g. the Internet connection is down. But I have no idea on how to get a return value or something out of that IMAP-login function. Here is the pastebin: https://pastebin.com/jiAD4z2Q - any ideas on where to
<SR__Sebastian> start?
<ruby[bot]> SR__Sebastian: we in #ruby do not like pastebin.com, I reposted your paste to gist for you: https://gist.github.com/0ba68faf2148da54d23f6e90ad383fb1
<ruby[bot]> SR__Sebastian: pastebin.com loads slowly for most, has ads which are distracting and has terrible formatting.
vondruch has quit [Client Quit]
vondruch has joined #ruby
hahuang61 has joined #ruby
Mon_Ouie has joined #ruby
hahuang61 has quit [Ping timeout: 276 seconds]
<havenwood> SR__Sebastian: Can you show us a bit more of your code for context? It's not clear from that snippet how you'd handle the retry.
<havenwood> SR__Sebastian: You should rescue `Net::IMAP::NoResponseError` specifically.
<havenwood> SR__Sebastian: `warn` instead of `puts` for errors
<havenwood> SR__Sebastian: String interpolation saves extra string allocations (just a nit).
<havenwood> SR__Sebastian: I puts backticks around the values ^ in the text output, so you can more easily see what's happening if the value is `nil`.
<havenwood> SR__Sebastian: You might want to consider using #inspect on the printed values.
<havenwood> >> nil.inspect
<ruby[bot]> havenwood: # => "nil" (https://eval.in/847825)
<havenwood> SR__Sebastian: If you show more code we'll be able to give better advice.
<havenwood> SR__Sebastian: File inherits from IO. Use File when dealing with Files.
astrobunny has joined #ruby
SR__Sebastian has quit [Quit: Leaving]
SR__Sebastian has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
astrobunny has quit [Ping timeout: 240 seconds]
rrode has quit [Ping timeout: 240 seconds]
marr has joined #ruby
rrode has joined #ruby
chouhoulis has quit [Remote host closed the connection]
beilabs has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
bronson has joined #ruby
_aeris_ has quit [Remote host closed the connection]
cdg has joined #ruby
conta has joined #ruby
_aeris_ has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
harai has joined #ruby
<funkytwig> this is verry odd, for
<funkytwig> if when_array[0].upcase=='SUNDAY' && when_array[1].upcase ='LUNCH' then
<funkytwig> I get 'Exception `NoMethodError' at scrape_web_olddukebri.rb:31 - undefined method `upcase=' for "Lunch":String
<funkytwig> '
<havenwood> funkytwig: use spaces
<funkytwig> havenwood, silly me, I had = not ==;(
_aeris_ has quit [Remote host closed the connection]
ta_ has joined #ruby
_aeris_ has joined #ruby
SR__SebastianR has joined #ruby
ta_ has quit [Ping timeout: 240 seconds]
SR__Sebastian has quit [Ping timeout: 240 seconds]
SqREL has quit [Remote host closed the connection]
weaksauce has joined #ruby
DTZUZU has joined #ruby
SR__SebastianR has quit [Quit: Leaving]
ta_ has joined #ruby
manjaro-kde5- has joined #ruby
manjaro-kde5- has quit [Client Quit]
astrobunny has joined #ruby
chouhoulis has joined #ruby
astrobunny has quit [Ping timeout: 240 seconds]
chouhoulis has quit [Ping timeout: 240 seconds]
beilabs has joined #ruby
SqREL has joined #ruby
username_ has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
SqREL has quit [Ping timeout: 248 seconds]
Dark_Arc has joined #ruby
Dark_Arc has quit [Client Quit]
Dark_Arc has joined #ruby
Dark_Arc has quit [Client Quit]
Dark_Arc has joined #ruby
astrobunny has joined #ruby
astrobunny has quit [Ping timeout: 248 seconds]
harai has quit [Ping timeout: 246 seconds]
conta has quit [Ping timeout: 255 seconds]
d0nn1e has joined #ruby
mikecmpbll has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 248 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
hahuang61 has joined #ruby
nofxxxx has quit [Quit: Leaving]
nofxx has joined #ruby
hahuang61 has quit [Ping timeout: 246 seconds]
belmoussaoui has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
nobitanobi has joined #ruby
bronson has joined #ruby
vondruch has quit [Client Quit]
AndBobsYourUncle has joined #ruby
vondruch has joined #ruby
AndBobsYourUncle has quit [Client Quit]
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
bronson has quit [Ping timeout: 248 seconds]
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
enterprisey has joined #ruby
tomphp has joined #ruby
uZiel has quit [Ping timeout: 268 seconds]
t-recx has quit [Quit: t-recx]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
AndBobsYourUncle has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AndBobsYourUncle has quit [Client Quit]
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
AndBobsYourUncle has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
AndBobsYourUncle has quit [Client Quit]
vondruch has quit [Client Quit]
jamesaxl has joined #ruby
AndBobsYourUncle has joined #ruby
vondruch has joined #ruby
AndBobsYourUncle has quit [Client Quit]
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
cout has joined #ruby
ramfjord has joined #ruby
raynold has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
nobitanobi has quit [Remote host closed the connection]
astrobunny has joined #ruby
username_ has quit [Ping timeout: 240 seconds]
astrobunny has quit [Ping timeout: 240 seconds]
Asher has quit [Quit: Leaving.]
howdoi has quit [Quit: Connection closed for inactivity]
t-recx has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
x|h has joined #ruby
rrode has quit [Ping timeout: 240 seconds]
tomphp has joined #ruby
bruno- has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has quit [Client Quit]
vondruch has quit [Quit: vondruch]
jamesaxl has quit [Quit: WeeChat 1.8]
segy has quit [Ping timeout: 240 seconds]
vondruch has joined #ruby
<darix> funkytwig: that's why some people recommend to have the constant value first
cdg has quit [Remote host closed the connection]
vondruch has quit [Client Quit]
lexruee has quit [Ping timeout: 240 seconds]
cdg has joined #ruby
bruno-_ has joined #ruby
segy has joined #ruby
vondruch has joined #ruby
bruno- has quit [Ping timeout: 248 seconds]
cdg has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
nobitanobi has joined #ruby
dennisvennink has joined #ruby
cdg has joined #ruby
runescape07rsps has quit [Ping timeout: 240 seconds]
SteenJobs has joined #ruby
nobitanobi has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
hahuang61 has joined #ruby
nostalgiccloud has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
hahuang61 has quit [Ping timeout: 240 seconds]
s3nd1v0g1us has quit [Quit: tempusfugit]
astrobunny has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
dviola has joined #ruby
tvw has quit []
TomyLobo has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
SteenJobs has joined #ruby
vondruch has quit [Quit: vondruch]
enterprisey has quit [Ping timeout: 276 seconds]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
beilabs has quit [Remote host closed the connection]
canteen4 has joined #ruby
aduabu has joined #ruby
<aduabu> Hey folks
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
canteen4 has quit [Ping timeout: 240 seconds]
bronson has joined #ruby
astrobunny has quit [Ping timeout: 240 seconds]
Rodya_ has joined #ruby
enterprisey has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
ur5us has joined #ruby
Rodya_ has quit [Remote host closed the connection]
alex`` has quit [Quit: WeeChat 1.9]
bronson has quit [Ping timeout: 240 seconds]
ur5us has quit [Remote host closed the connection]
<aduabu> Let's say I have 2 arrays, one is like a pack of cigarrette with different brands of ciggarrettes and second array is like a dozen of different brand of cigarrette packs, and I want to be able to pick a pack of malboro from the second array if someone pick a stick of malboro from first array. I think I can use subscribe method to do it but it looks too much of code for it, can anyone advise me
<aduabu> on a more simple way to achieve this? Thanks.
canteen4 has joined #ruby
runescape07rsps has joined #ruby
canteena has joined #ruby
aduabu has quit [Ping timeout: 240 seconds]
canteen4 has quit [Ping timeout: 240 seconds]
SqREL has joined #ruby
canteen4 has joined #ruby
Stickwalker has joined #ruby
SqREL has quit [Ping timeout: 240 seconds]
canteena has quit [Ping timeout: 248 seconds]
<canteen4> Can anyone please advise on a way out of this
xcesariox has quit [Read error: Connection reset by peer]
canteena has joined #ruby
<canteena> The confusing part is the second array is from a datable in my project but the first array is coming from some api
canteen4 has quit [Ping timeout: 248 seconds]
enterprisey has quit [Ping timeout: 240 seconds]
canteen4 has joined #ruby
sepp2k1 has joined #ruby
lasey has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
lasey has joined #ruby
sepp2k has quit [Ping timeout: 248 seconds]
<havenwood> canteen4: Give an example of the data you have and the result you want?
canteena has quit [Ping timeout: 240 seconds]
<havenwood> canteen4: Even a very small example will do.
gusrub has joined #ruby
<canteen4> The data array
<havenwood> "it is easier for humans to understand complex data compared with complex logic"
vondruch has quit [Client Quit]
vondruch has joined #ruby
canteena has joined #ruby
<havenwood> canteen4: Even a contrived example will do. I have `[1, 2, 3]` and `{1 => 42, 2 => 84}` and I want `{1 => 42, 2 => 82, 3 => nil}` for example.
dionysus69 has quit [Ping timeout: 240 seconds]
<havenwood> canteen4: Your psudocode looks like an array of arrays with just false and true value. So I don't think that's what you mean.
gusrub has quit [Remote host closed the connection]
canteen4 has quit [Ping timeout: 255 seconds]
S007 has quit [Ping timeout: 246 seconds]
<canteena> The thing is a like sticks = ["first" => "malboro", "second" => "kent], packs=[{"brand" => "malboro", "type" = "light"}, {"brand" => "kent", "type" => "menthol"}]
<canteena> so I want a situation where if the case is stick.first from correspond to pack.malboro
<canteena> I read you havenwood
gixxer1k has quit [Quit: Leaving]
<havenwood> canteena: What's the result you want? What return value?
<canteena> But it all have be inside that loop
<havenwood> given that `sticks` and `packs`, what result do you want?
<canteena> I want packs
<havenwood> oh, given sticks, you want packs?
<canteena> Yes exactly
<havenwood> canteena: so you have: sticks = {"first" => "malboro", "second" => "kent"}
<canteena> I want the packs object
<havenwood> canteena: and you want: packs = [{"brand" => "malboro", "type" => "light"}, {"brand" => "kent", "type" => "menthol"}]
<canteena> yes
<havenwood> canteena: Where does the `"light"` from `{"type" => "light"}` come from?
<havenwood> canteena: You seem to have only shown one half of the input data.
<canteena> as you can see the packs array contain objects
vondruch has quit [Quit: vondruch]
<havenwood> you can't get from sticks to packs in your example without additional information
<havenwood> show us
vondruch has joined #ruby
<canteena> so I want to tie the stick string to the pack object
<havenwood> you haven't shown enough
<go|dfish> they have both sticks and packs - they want to process each item in sticks and lookup the corresponding item in packs based on the brand name
<havenwood> so packs isn't desired output? i'm confused...
<canteena> yea but after iteration the sticks becomes a string while the packs becomes an object
ltem has quit [Quit: Leaving]
<canteena> I want to be able to get hold of the pack object so I want list more of it's attributes
<havenwood> canteena: So is `packs` the return value you want or not? Can you just show the input values you have and the output value you want?
<canteena> Yea I want to get this packs.collect{|pack| }
<havenwood> What value does that return?
Dimik has quit [Ping timeout: 240 seconds]
<canteena> I can do packs.each{|pack| puts pack} normally
<havenwood> I'm still unclear if you mean given `sticks` and `packs` you want a third as-yet unseen thing, or if you mean given `sticks` and some as-yet unseen thing the return value is `packs`.
<havenwood> canteena: Forget the psudocode. What is the return value you seek?
vondruch has quit [Client Quit]
vondruch has joined #ruby
SqREL has joined #ruby
<canteena> but I want to be able to do sticks.collect{|stick| packs.collect{|pack| p = "#{pack} == #{stick} pack.type}}
<canteena> but I want to be able to do sticks.collect{|stick| packs.collect{|pack| p = "#{pack} == #{stick} p.type}}
<havenwood> So you want???: [[true, false, false], [false, false, false]]
<canteena> The second one is the actual thing I hope to achieve
<canteena> but I want to be able to do sticks.collect{|stick| packs.collect{|pack| p = "#{pack} == #{stick} p.type}}
<havenwood> canteena: You must want a return value. What is it?
<canteena> I want to return p = "#{pack} == {stick}"
<havenwood> canteena: Like I have `2` and `2`. I want `4`.
<havenwood> canteena: You want to return a single string, given `sticks` and `packs`?
<havenwood> canteena: Really?
<canteena> I want to return object not string
<havenwood> canteena: You mean a Hash?
ecuanaso has joined #ruby
<canteena> yea
<havenwood> >> {}.class
<ruby[bot]> havenwood: # => Hash (https://eval.in/847872)
<canteena> Hash
<canteena> I want to return not string
<canteena> hash not string
<havenwood> canteena: Show the Hash. Not with variables, the actual Hash that is the return value of the statement.
<havenwood> canteena: *What* do you want to return. That's what I'm asking you to show us.
<havenwood> The actual return value. No variables.
<havenwood> Just show us that and we'll easily be able to give you solutions.
<canteena> packs.each{|pack| puts pack} this returns hash
runescape07rsps has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
<canteena> this is what I want to return but I want to compare it to a stick string
vondruch has joined #ruby
<canteena> so if stick.first == pack.brand, I want to return that particular hash
<havenwood> canteena: So I commented on your gist with an example of input values and desired output value: https://gist.github.com/anonymous/b91f1525ecdbef50da1842ebcbf3975d
<havenwood> canteena: Please look at what the output value example looks like.
<canteena> Alright thanks let me look at it now
<havenwood> canteena: Not it isn't psudocode. You can paste it in irb or pry and it's a Hash.
<havenwood> Note*
lexruee has joined #ruby
<havenwood> If you can give us a desired output value like that it'll be easy to help you.
<havenwood> canteena: I'm assuming that's not the return value you want, given `sticks` and `packs`. But that's what we're after. The return value you want.
naitian has quit [Ping timeout: 246 seconds]
canteen4 has joined #ruby
ecuanaso has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
naitian has joined #ruby
vondruch has quit [Quit: vondruch]
enterprisey has joined #ruby
vondruch has joined #ruby
canteena has quit [Ping timeout: 248 seconds]
<havenwood> canteena: A solution given that desired result would be: sticks.each_with_object({}) { |(position, brand), result| result[position] = packs.find { |pack| pack['brand'] == brand } } #=> {"first"=>{"brand"=>"malboro", "type"=>"light"}, "second"=>{"brand"=>"kent", "type"=>"menthol"}}
<canteen4> ok
enterprisey has quit [Read error: Connection reset by peer]
<canteen4> Looks great
<havenwood> >> sticks = {"first" => "malboro", "second" => "kent"}; packs = [{"brand" => "malboro", "type" => "light"}, {"brand" => "kent", "type" => "menthol"}]; sticks.each_with_object({}) { |(position, brand), result| result[position] = packs.find { |pack| pack['brand'] == brand } }
<ruby[bot]> havenwood: # => {"first"=>{"brand"=>"malboro", "type"=>"light"}, "second"=>{"brand"=>"kent", "type"=>"menthol"}} (https://eval.in/847873)
Rodya_ has joined #ruby
beilabs has joined #ruby
<canteen4> Thanks havenwood, I haven't tried this before
chouhoulis has joined #ruby
<havenwood> canteen4: I'd say think about what return value you really want, then ask again. There are many solutions and folk here can help you find a good one.
<havenwood> canteen4: I'd suggest looking carefully at the documentation for the Array and Hash classes and the Enumerable module that they both mixin.
<havenwood> &ri Enumerable
<havenwood> $ri Hash
<havenwood> &ri Hash
<canteen4> Alright havenwood, I have looked at that section in ruby cookbook for hours
<havenwood> &ri Array
<havenwood> canteen4: Was my example return value anything close to what you want?
<canteen4> Let try this idea on and think on it a bit I will come back with much clear questions
<havenwood> canteen4: Happy coding!
Rodya_ has quit [Ping timeout: 255 seconds]
<canteen4> yea it looks like I was confused but I saw an example like the one you suggested
beilabs has quit [Ping timeout: 240 seconds]
<canteen4> Thanks I will be around
chouhoulis has quit [Ping timeout: 240 seconds]
Stickwalker has quit [Quit: Leaving]
eljimmy has joined #ruby
SqREL has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
shwouchk has joined #ruby
canteena has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
canteen4 has quit [Ping timeout: 240 seconds]
canteen4 has joined #ruby
Mon_Ouie has quit [Ping timeout: 276 seconds]
hahuang61 has joined #ruby
nostalgiccloud has quit [Read error: Connection reset by peer]
vondruch has quit [Quit: vondruch]
Mon_Ouie has joined #ruby
vondruch has joined #ruby
canteena has quit [Ping timeout: 240 seconds]
testerirc has joined #ruby
canteena has joined #ruby
testerirc has quit [Client Quit]
hahuang61 has quit [Ping timeout: 240 seconds]
canteen4 has quit [Ping timeout: 240 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
ecuanaso has joined #ruby
cgibsonmm has joined #ruby
canteen4 has joined #ruby
SqREL has joined #ruby
cgibsonmm has quit [Client Quit]
canteena has quit [Ping timeout: 248 seconds]
canteena has joined #ruby
m27frogy has quit [Ping timeout: 240 seconds]
AndBobsYourUncle has joined #ruby
AndBobsYourUncle has quit [Client Quit]
SqREL has quit [Ping timeout: 248 seconds]
canteen4 has quit [Ping timeout: 240 seconds]
canteen4 has joined #ruby
dlitvak has joined #ruby
aduabu has joined #ruby
canteena has quit [Ping timeout: 248 seconds]
canteen4 has quit [Ping timeout: 255 seconds]
cdg has quit [Remote host closed the connection]
canteen4 has joined #ruby
aduabu has quit [Ping timeout: 240 seconds]
aduabu has joined #ruby
canteen4 has quit [Ping timeout: 248 seconds]
Cohedrin_ has joined #ruby
dennisvennink has quit [Quit: Textual IRC Client: www.textualapp.com]
canteen4 has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
aduabu has quit [Ping timeout: 255 seconds]
sepp2k1 has quit [Read error: Connection reset by peer]
aduabu has joined #ruby
biberu has quit []
nostalgiccloud has joined #ruby
canteen4 has quit [Ping timeout: 248 seconds]
vondruch has quit [Quit: vondruch]
canteen4 has joined #ruby
vondruch has joined #ruby
aduabu has quit [Ping timeout: 255 seconds]
aduabu has joined #ruby
canteen4 has quit [Ping timeout: 248 seconds]
vondruch has quit [Client Quit]
vondruch has joined #ruby
bronson has joined #ruby
canteen4 has joined #ruby
aduabu has quit [Ping timeout: 255 seconds]
m27frogy has joined #ruby
aduabu has joined #ruby
<funkytwig> darix, good plan, guess it throws a runtime error
funkytwig has quit [Quit: Leaving]
im314ous has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bronson has quit [Ping timeout: 248 seconds]
canteen4 has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
jackjackdripper has joined #ruby
canteen4 has joined #ruby
aduabu has quit [Ping timeout: 255 seconds]
aduabu has joined #ruby
canteen4 has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
preyalone has joined #ruby
elsevero has joined #ruby
canteen4 has joined #ruby
ramfjord has quit [Ping timeout: 240 seconds]
TomyLobo has quit [Ping timeout: 255 seconds]
sameerynho has quit [Quit: WeeChat 1.7]
aduabu has quit [Ping timeout: 255 seconds]
aduabu has joined #ruby
canteen4 has quit [Ping timeout: 240 seconds]
Qommand0r has quit [Quit: WeeChat 1.9]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Qommand0r has joined #ruby
jgt2 has quit [Ping timeout: 240 seconds]
enterprisey has joined #ruby
nostalgiccloud has quit [Read error: Connection reset by peer]
xaxisx has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
SqREL has joined #ruby
canteen4 has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
aduabu has quit [Ping timeout: 240 seconds]
SqREL has quit [Ping timeout: 240 seconds]
aduabu has joined #ruby
canteen4 has quit [Ping timeout: 255 seconds]
canteen4 has joined #ruby
robouk has joined #ruby
ixti has joined #ruby
aduabu has quit [Ping timeout: 240 seconds]
aduabu has joined #ruby
canteen4 has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
alfiemax has joined #ruby
canteen4 has joined #ruby
aduabu has quit [Ping timeout: 240 seconds]
aduabu has joined #ruby
enterprisey has quit [Remote host closed the connection]
dstrunk has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
canteen4 has quit [Ping timeout: 255 seconds]
minimalism has joined #ruby
minimalism has quit [Client Quit]
im314ous has joined #ruby
minimalism has joined #ruby
canteen4 has joined #ruby
aduabu has quit [Ping timeout: 248 seconds]
x|h has quit [Remote host closed the connection]
aduabu has joined #ruby
x|h has joined #ruby
x|h has quit [Remote host closed the connection]
Bhootrk_ has joined #ruby
Bhootrk_ has quit [Max SendQ exceeded]
canteen4 has quit [Ping timeout: 248 seconds]
canteen4 has joined #ruby