havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.3, 2.5.5, 2.7.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
orbyt_ has joined #ruby
staticx has joined #ruby
chalkmonster has joined #ruby
exmortus has quit [Ping timeout: 258 seconds]
emptyfl4sk has joined #ruby
emptyfl4sk has quit [Ping timeout: 248 seconds]
Dr_MDMA_MD has quit []
<havenwood> Looky there, it's master not trunk now: https://github.com/ruby/ruby/commit/f2769ae2c9f5c5a902584282f1e512437db1f395
<havenwood> The gitification seems complete.
al-damiri has quit [Quit: Connection closed for inactivity]
psilly0 has quit [Ping timeout: 268 seconds]
AlHafoudh has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlHafoudh has quit [Ping timeout: 272 seconds]
Dr_MDMA_MD has joined #ruby
yokel has quit [Read error: Connection reset by peer]
yokel has joined #ruby
emptyfl4sk has joined #ruby
emptyfl4sk has quit [Ping timeout: 245 seconds]
fphilipe_ has joined #ruby
FastJack has joined #ruby
henninb has joined #ruby
fphilipe_ has quit [Ping timeout: 246 seconds]
mkroman has quit [Remote host closed the connection]
yokel has quit [Read error: Connection reset by peer]
yokel has joined #ruby
henninb has quit [Quit: leaving]
henninb has joined #ruby
henninb has quit [Client Quit]
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
henninb has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_dbugger has joined #ruby
dbugger has quit [Ping timeout: 252 seconds]
henninb has quit [Client Quit]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wald0 has quit [Quit: Lost terminal]
henninb has joined #ruby
codefriar has joined #ruby
gix has quit [Ping timeout: 246 seconds]
FastJack has quit [Ping timeout: 264 seconds]
duderonomy has joined #ruby
FastJack has joined #ruby
pinky has joined #ruby
<pinky> anyone seen any faraday middleware that can retry requests (connection refused, timeout) against a list of URLs?
codefriar has quit [Read error: Connection reset by peer]
codefriar has joined #ruby
Swyper has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlHafoudh has joined #ruby
r0ph has joined #ruby
r0ph has quit [Changing host]
r0ph has joined #ruby
henninb_ has joined #ruby
henninb_ has quit [Client Quit]
henninb has quit [Remote host closed the connection]
Dr_MDMA_MD has quit []
AlHafoudh has quit [Ping timeout: 248 seconds]
Swyper has quit [Remote host closed the connection]
Dr_MDMA_MD has joined #ruby
Swyper has joined #ruby
dviola has quit [Quit: WeeChat 2.5]
braincrash has quit [Quit: bye bye]
AJA4350 has quit [Remote host closed the connection]
emptyfl4sk has joined #ruby
Technodrome has joined #ruby
Junaos has quit [Quit: ZNC - http://znc.in]
braincrash has joined #ruby
emptyfl4sk has quit [Ping timeout: 248 seconds]
sarink has joined #ruby
Technodrome has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
tdy has joined #ruby
code_zombie has quit [Quit: Leaving]
fphilipe_ has joined #ruby
cd has quit [Quit: cd]
Swyper has joined #ruby
fphilipe_ has quit [Ping timeout: 272 seconds]
Junaos has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
_whitelogger has joined #ruby
<havenwood> pinky: Faraday can handle retries. By default, it just retries timeout exceptions.
<havenwood> pinky: You can pass it other exceptions.
<havenwood> pinky: Is there something about Faraday's retries that doesn't work for your case?
sarink has quit [Remote host closed the connection]
emptyfl4sk has joined #ruby
emptyfl4sk has quit [Ping timeout: 245 seconds]
codefriar has quit [Quit: Textual IRC Client: www.textualapp.com]
ImAdPEr|gOhOMe is now known as ImAdPEr|wORkInG
Swyper has quit [Remote host closed the connection]
codefriar has joined #ruby
s3nd1v0g1us has quit [Ping timeout: 248 seconds]
Tuor has joined #ruby
Fusl has quit [Max SendQ exceeded]
Tuor has quit [Quit: Konversation terminated!]
Fusl has joined #ruby
jmcgnh has quit [Ping timeout: 245 seconds]
jmcgnh_ has joined #ruby
jmcgnh_ is now known as jmcgnh
greypack has quit [Read error: Connection reset by peer]
greypack has joined #ruby
queip has quit [Ping timeout: 272 seconds]
queip has joined #ruby
AlHafoudh has joined #ruby
fphilipe_ has joined #ruby
Fusl has quit [Max SendQ exceeded]
Fusl has joined #ruby
AlHafoudh has quit [Ping timeout: 248 seconds]
yokel has quit [Remote host closed the connection]
fphilipe_ has quit [Ping timeout: 248 seconds]
yokel has joined #ruby
greypack has quit [Ping timeout: 245 seconds]
codefriar has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy has quit [Remote host closed the connection]
conta has joined #ruby
ur5us_ has quit [Remote host closed the connection]
sarink has joined #ruby
brool has quit [Ping timeout: 250 seconds]
emptyfl4sk has joined #ruby
absolutejam1 has joined #ruby
fphilipe_ has joined #ruby
Inline has quit [Quit: Leaving]
dhollinger has quit [Quit: WeeChat 2.2]
emptyfl4sk has quit [Ping timeout: 245 seconds]
sandstrom has joined #ruby
kyrylo has joined #ruby
schne1der has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
schne1der has quit [Ping timeout: 245 seconds]
emptyfl4sk has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sarink has quit [Ping timeout: 268 seconds]
silviu has joined #ruby
emptyfl4sk has quit [Ping timeout: 246 seconds]
dionysus69 has quit [Remote host closed the connection]
rainer_tm has quit [Ping timeout: 248 seconds]
rippa has joined #ruby
dionysus69 has joined #ruby
silviu12 has quit [Read error: Connection reset by peer]
rainer_tm has joined #ruby
shenghi has quit [Ping timeout: 248 seconds]
queip has quit [Ping timeout: 248 seconds]
shenghi has joined #ruby
aupadhye has joined #ruby
sauvin has joined #ruby
cranq has quit [Remote host closed the connection]
sarink has joined #ruby
cranq has joined #ruby
queip has joined #ruby
absolutejam1 has quit [Ping timeout: 245 seconds]
megamos has joined #ruby
queip has quit [Ping timeout: 245 seconds]
AlHafoudh has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
deepreds1 has quit [Ping timeout: 268 seconds]
Nicmavr has joined #ruby
suukim has joined #ruby
yokel has quit [Remote host closed the connection]
queip has joined #ruby
AlHafoudh has quit [Ping timeout: 258 seconds]
vjacob has quit [Ping timeout: 258 seconds]
yokel has joined #ruby
fphilipe_ has quit [Ping timeout: 258 seconds]
lxsameer has joined #ruby
schne1der has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
mayurvpatil has joined #ruby
mayurvpatil has quit [Read error: Connection reset by peer]
sarink has quit [Ping timeout: 246 seconds]
AlHafoudh has joined #ruby
dionysus69 has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
ananth99 has joined #ruby
dionysus69 has joined #ruby
nomenkun has joined #ruby
deepreds1 has joined #ruby
fphilipe_ has joined #ruby
sarink has joined #ruby
mayurvpatil has joined #ruby
mayurvpatil has quit [Client Quit]
NL3limin4t0r has joined #ruby
<ZAJDAN> what is the difference between cgi.params["dir"] ...and ... cgi["dir"]
megamos has quit [Ping timeout: 258 seconds]
jmcgnh_ has joined #ruby
jmcgnh has quit [Ping timeout: 244 seconds]
jmcgnh_ is now known as jmcgnh
jacksop has joined #ruby
conta has quit [Quit: conta]
<havenwood> ZAJDAN: The latter returns only the first value, even if the former has many.
<ZAJDAN> hawenwood: thank You
<ZAJDAN> in same way as in Ruby I can use CGI in Rails?
deepreds1 has quit [Ping timeout: 248 seconds]
deepreds1 has joined #ruby
<havenwood> ZAJDAN: Yeah, Rails is just Ruby.
<ZAJDAN> ok..thank YOu
deepreds1 has quit [Ping timeout: 244 seconds]
<ZAJDAN> how I can extract first parameter 'dir' ? ...this come from AJAX: Parameters: {"dir"=>"6_BUGGY/", "onlyFolders"=>"false", "onlyFiles"=>"false", "multiSelect"=>"false"}
deepreds1 has joined #ruby
<ZAJDAN> I am trying: if cgi.has_key?('dir') puts "is there" else dir = cgi.params["dir"].to_s end
<ZAJDAN> is possibe via CGI process aforesaid hash?
absolutejam1 has joined #ruby
mayurvpatil has joined #ruby
ellcs has joined #ruby
queip has quit [Ping timeout: 245 seconds]
emptyfl4sk has joined #ruby
Freshnuts has quit [Quit: Leaving]
queip has joined #ruby
kyrylo has joined #ruby
emptyfl4sk has quit [Ping timeout: 245 seconds]
thunderbirdtr has quit [Quit: ZNC 1.7.3 - https://znc.in]
absolutejam1 has quit [Ping timeout: 258 seconds]
absolutejam1 has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
emptyfl4sk has joined #ruby
<NL3limin4t0r> ZAJDAN: Why do you need to use CGI in RoR? The framework already handles incomming requests parameters and offers them through the `params` method. You can simply do `params.include?(:dir)` or `params.include?('dir')`
<ZAJDAN> NL3: ye...right now I already tested it
<NL3limin4t0r> You could also use `has_key?` or `key?` instead of `include?`
<ZAJDAN> dir = (params[:dir])
<NL3limin4t0r> But RoR stuff should be in the #RubyOnRails channel.
emptyfl4sk has quit [Ping timeout: 272 seconds]
DarthGandalf has quit [Ping timeout: 248 seconds]
jacksop has quit []
queip has quit [Ping timeout: 245 seconds]
queip has joined #ruby
Dr_MDMA_MD has quit [Quit: Connection closed for inactivity]
ryouba has joined #ruby
<ryouba> hi
<ryouba> is there something like Hash#||+= or if not, what's the most concise way of expressing that?
<ryouba> i.e. `foo ||= Hash.new; foo[:blah] ||+= 1`
absolutejam1 has quit [Ping timeout: 245 seconds]
<ryouba> (my current code is https://gist.github.com/sixtyfive/f79dfc1e5ad2ad7f62b682d989919120 and i'm wondering if there's a prettier way of writing that)
ur5us has joined #ruby
<balo> ryouba: unrelated but as a first suggestion, avoid using unless + else
<phaul> a [op]= b is a syntactic sugar for a = a [op] b. there is no sugar for multiple ops prefixing the =
<phaul> Im not even sure what they would desugar to. a [op1][op2]= b maybe a = a op1 a op2 b? or maybe 2 bs an one a
<ryouba> balo: hmm, why?
<balo> also you can set a default value for Hash, like: stats ||= Hash.new(0); stats[:foo] += 1
<balo> https://ruby-doc.org/core-2.6.3/Hash.html#method-c-new but keep in mind that it's not equivalent with your solution because the other keys will be missing
<ryouba> hmm we have a Ruby execution bot in here, right?
<ryouba> oh okay, that *is* a good argument
<ryouba> i actually confused myself for a second when i wrote it
* ryouba scratches head and wonders why head loves complexity so much
<balo> if you don't want to write `if !err` and you use rails, you can try `if err.blank?` to keep it nice
<ryouba> no sir, no rails here. did that for much longer than was good for my mental health. finally got rid of it some years ago. just plain ruby scripts now, and my life has become so much better since :-D
chens has joined #ruby
<ryouba> i do usually monkey patch #blank? into basically everything, though, because i find it helpful.
pwnd_nsfw has joined #ruby
queip has quit [Ping timeout: 248 seconds]
ananth99 has quit [Quit: Connection closed for inactivity]
queip has joined #ruby
<balo> yeah, it should be part of the stdlib i think, implemented natively. there is a reason why fast_blank exists
AlHafoudh has quit [Ping timeout: 272 seconds]
mayurvpatil has quit [Quit: This computer has gone to sleep]
dbugger has joined #ruby
_dbugger has quit [Ping timeout: 264 seconds]
absolutejam1 has joined #ruby
mayurvpatil has joined #ruby
_dbugger has joined #ruby
<ryouba> !Hash.new == Hash.new(0)
mikecmpbll has joined #ruby
<ryouba> hmm, okay, that's *not* how to use the bot
<ryouba> balo: seconded, and thirded, and fourthed.
dbugger has quit [Ping timeout: 264 seconds]
sarink has quit [Remote host closed the connection]
<ryouba> balo: can't find it rn, but there's some mailing list post by matz where he argues against making it part of stdlib. i only remember thinking that his arguments weren't strong enough to supersede the simple "a lot of people would use this all the time without any negative side effect" argument.
AlHafoudh has joined #ruby
sarink has joined #ruby
nomenkun has quit [Quit: Leaving...]
absolutejam1 has quit [Ping timeout: 272 seconds]
<ryouba> phaul: you're right, it would at the very least be ambiguous.
<ryouba> btw, balo: https://rubystyle.guide/
AlHafoudh has quit [Ping timeout: 272 seconds]
AlHafoudh has joined #ruby
ur5us has quit [Remote host closed the connection]
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
conta has joined #ruby
AlHafoudh has quit [Ping timeout: 248 seconds]
<balo> it's the same as the rubocop readme. just more fancier i guess
AlHafoudh has joined #ruby
conta has quit [Ping timeout: 268 seconds]
absolutejam1 has joined #ruby
AlHafoudh has quit [Ping timeout: 245 seconds]
haxx0r has quit [Remote host closed the connection]
absolutejam1 has quit [Ping timeout: 245 seconds]
chens has quit [Remote host closed the connection]
mayurvpatil has quit [Quit: This computer has gone to sleep]
AlHafoudh has joined #ruby
howdoi has joined #ruby
mayurvpatil has joined #ruby
conta has joined #ruby
Cthulu201 has quit [Quit: Nowhere special. I always wanted to go there.]
emptyfl4sk has joined #ruby
Raboo has joined #ruby
emptyfl4sk has quit [Ping timeout: 244 seconds]
reber has joined #ruby
reber_ has joined #ruby
AlHafoudh has quit [Quit: ZNC - http://znc.in]
reber_ has quit [Client Quit]
Cthulu201 has joined #ruby
<ryouba> balo: yes, a little more digestible as an evening lecture
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
absolutejam1 has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
absolutejam1 has quit [Ping timeout: 258 seconds]
emptyfl4sk has joined #ruby
<ZAJDAN> how to append a string to variable? means something like has PHP: somevariable = " string"; somevariable .= "next string";
<ZAJDAN> I foundit .concat is the right way
emptyfl4sk has quit [Ping timeout: 244 seconds]
<NL3limin4t0r> ryouba: In your code the hash might or might not exist, in this case you can simply add the default after creation. `@cols.send(col).stats.default = 0`
<NL3limin4t0r> ZAJDAN: You can use `"string 1" + "string 2"` to combine strings. This can also be used with assignment operators like `+=` eg. `string += "new addition"`
<NL3limin4t0r> Or if you don't mind mutating the original string: `string << "new addition"`
<ZAJDAN> name of method can be camelCase ?
absolutejam1 has joined #ruby
conta has quit [Ping timeout: 248 seconds]
absolutejam1 has quit [Ping timeout: 268 seconds]
conta has joined #ruby
absolutejam1 has joined #ruby
absolutejam1 has quit [Ping timeout: 244 seconds]
conta has quit [Ping timeout: 272 seconds]
dhollinger has joined #ruby
mayurvpatil has quit [Quit: This computer has gone to sleep]
conta has joined #ruby
<NL3limin4t0r> Ruby itself uses snakecase and for consistency sake that is what is recommended in the style guide ^
<NL3limin4t0r> Examples are: Array#delete_if, Module#append_features, Hash#has_key?
dhollinger has quit [Quit: WeeChat 2.3]
<pinky> havenwood: sorry was in bed .. i wanted to retry but with a different URL
dhollinger has joined #ruby
Tuor has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
codefriar has joined #ruby
reber has quit [Read error: Connection reset by peer]
dviola has joined #ruby
henninb has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
al-damiri has joined #ruby
n13z has quit [Ping timeout: 246 seconds]
henninb has quit [Quit: leaving]
henninb has joined #ruby
lucasb has joined #ruby
emptyfl4sk has joined #ruby
AJA4350 has joined #ruby
emptyfl4sk has quit [Ping timeout: 272 seconds]
vondruch has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
Swyper has joined #ruby
snigelfarfar_ has joined #ruby
<snigelfarfar_> hi
<snigelfarfar_> test = "test"; test.each_char{|g| test.reverse.chomp(g)}
<snigelfarfar_> why doesnt this work as anticipated
<snigelfarfar_> test should be empty but test = "test"
Lyubo1 has joined #ruby
<phaul> each_char returns what
<phaul> was the receiver if black was given
<phaul> block*
codefriar has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul> &>> 'hello'.each_char { 'doesnt_matter_what_this_is' }
<rubydoc> # => "hello" (https://carc.in/#/r/76cz)
Inline has joined #ruby
<phaul> you can chain a #map on it as it returns an Enumerator if no block was given
kyrylo has joined #ruby
absolutejam1 has joined #ruby
conta has quit [Ping timeout: 268 seconds]
Swyper has quit [Remote host closed the connection]
sarink has quit [Remote host closed the connection]
spiette has quit [Quit: ZNC 1.7.3 - https://znc.in]
sarink has joined #ruby
<phaul> &>> test = "test"; test.each_char.map { |g| test.reverse.chomp(g) }
<rubydoc> # => ["tse", "tset", "tset", "tse"] (https://carc.in/#/r/76d4)
schne1der has quit [Ping timeout: 245 seconds]
spiette has joined #ruby
sarink has quit [Ping timeout: 246 seconds]
vondruch_ has joined #ruby
sarink has joined #ruby
vondruch has quit [Ping timeout: 268 seconds]
vondruch_ is now known as vondruch
absolutejam1 has quit [Ping timeout: 248 seconds]
emptyfl4sk has joined #ruby
Swyper has joined #ruby
<havenwood> Interesting to see Tokaido back alive with 2.6 support!
sarink has quit [Remote host closed the connection]
brool has joined #ruby
irc_chat has joined #ruby
megamos has joined #ruby
conta has joined #ruby
<NL3limin4t0r> snigelfarfar_: It depends on what you expect, both #reverse and #chomp don't mutate the array, but create a new copy. Since #each_char doesn't do anything with the returned value you could say `.reverse.chomp(g)` are called in void context.
queip has quit [Ping timeout: 246 seconds]
englishm has quit [Excess Flood]
englishm has joined #ruby
Swyper has quit [Remote host closed the connection]
<NL3limin4t0r> &>> test = 'test'; test.each_char { |char| test.reverse!.chomp!(char) }
<rubydoc> # => "es" (https://carc.in/#/r/76db)
queip has joined #ruby
<NL3limin4t0r> Keep in mind that iterating over an collection and modifying it at the same time might yield unexpected results.
Swyper has joined #ruby
ellcs has quit [Ping timeout: 245 seconds]
<NL3limin4t0r> In this case it takes the `t` and `e`, removes both from the string. After that there are only 2 characters left, since #each_char iterated 2 times it thinks it is done. So the `e` and `s` stay behind.
<NL3limin4t0r> &>> test = 'test'; test.dup.each_char { |char| test.reverse!.chomp!(char) }
<rubydoc> # => "test" (https://carc.in/#/r/76dc)
Swyper has quit [Remote host closed the connection]
<NL3limin4t0r> &>> test = 'test'; test.dup.each_char { |char| test.reverse!.chomp!(char) }; test
<rubydoc> # => "es" (https://carc.in/#/r/76dd)
absolutejam1 has joined #ruby
irc_chat has left #ruby [#ruby]
absolutejam1 has quit [Ping timeout: 258 seconds]
Fired_Fart has joined #ruby
emptyfl4sk has quit [Ping timeout: 268 seconds]
mayurvpatil has joined #ruby
troulouliou_div2 has joined #ruby
schne1der has joined #ruby
Mrgoose has quit [Ping timeout: 244 seconds]
yokel has quit [Read error: Connection reset by peer]
orbyt_ has joined #ruby
yokel has joined #ruby
Fired_Fart has quit [Quit: Fired_Fart]
ajamielittle has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Quintasan has quit [Remote host closed the connection]
Quintasan has joined #ruby
Quintasan has quit [Changing host]
Quintasan has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
troulouliou_div2 has quit [Read error: Connection reset by peer]
deepreds1 has quit [Ping timeout: 272 seconds]
AndroidKitKat has left #ruby ["Leaving"]
queip has quit [Ping timeout: 272 seconds]
queip has joined #ruby
absolutejam1 has joined #ruby
conta has quit [Remote host closed the connection]
absolutejam1 has quit [Ping timeout: 272 seconds]
orbyt_ has joined #ruby
mayurvpatil has quit [Quit: This computer has gone to sleep]
fphilipe_ has quit [Ping timeout: 272 seconds]
sylario has joined #ruby
Mrgoose8 has joined #ruby
sarink has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
NL3limin4t0r is now known as NL3limin4t0r_afk
Mrgoose8 has quit [Ping timeout: 246 seconds]
lepepe has joined #ruby
duderonomy has joined #ruby
erry has joined #ruby
<erry> is "foo if bar else baz" a thing?
<erry> i see it all oer some code
<erry> it's symntax erroring
<erry> i know exactly 0 ruby
<erry> i don't understand how that works
<ytti> where exactly do you see it, do you have a link to a line in github
<ytti> in python that would be thing, but not in ruby
<erry> let me paste..
<ytti> bar ? foo : baz
<ytti> would be ruby equivalent
<erry> lines 9-11 i guess
<ytti> it doesn't do what you asked tho
<erry> what does it do?
<ytti> it has two conditions, your ask has true and false branch
Mrgoose8 has joined #ruby
<ytti> if both conditinos are true it returns true
<ytti> that is really odd awkard code tho
<ytti> hmm
<erry> it's syntax erroring for me
<erry> which is weird because i assume it works for someone
<erry> it's been in our codebase for months
<erry> it's not written by programmers
<erry> :D
<ytti> the code is
<ytti> def method
<ytti> ..
<ytti> else
<ytti> .
<ytti> end
<ytti> it's not else on the return line
<erry> what's it else-ing
<ytti> it's no-op in that code
<ytti> it could be removed with no change to code
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ytti> it only make sense in context of rescue
<ytti> def method
<ytti> ..
<ytti> rescue some_Error
<ytti> ..
<ytti> else
<ytti> we didnt need rescue
<ytti> end
<havenwood> +1 that it looks like a rescue was removed.
<havenwood> erry: rescue/else is the only context this would make sense, and the indentation confirms.
emptyfl4sk has joined #ruby
<havenwood> erry: Where'd the rescue go?
<erry> well
<erry> thjat'd explain "else without rescue is useless"
<erry> i think what happened is "someone wrote really horrible code" and i have some "warnings are errors" thing going on that normally isn't thr
megamos has quit [Ping timeout: 268 seconds]
psilly0 has joined #ruby
<erry> there*
<erry> thanks.. i get it now
<erry> :|
<erry> why is this a thing *sob*
<ytti> there are, unfortunately, many thing in that short piece of code which communicates that person isn't particularly familiar with ruby
<erry> ytti: it's written by qa engineers
duderonomy has joined #ruby
<erry> i don't know why they picked a relatively difficult language
<erry> they can't really code
Tuor has quit [Ping timeout: 272 seconds]
AJA4351 has joined #ruby
<havenwood> erry: Is this Rails code?
Snowy has joined #ruby
<erry> havenwood: no it's tests with cucumber and what not
<erry> there's no rails involved
AJA4350 has quit [Ping timeout: 248 seconds]
AJA4351 is now known as AJA4350
DarthGandalf has joined #ruby
<havenwood> erry: I was just going to suggest different changes if it was Rails.
<havenwood> erry: Is that really meant to be the second index for `new_send_invite_btn` and `new_added_email`?
duderonomy has quit [Ping timeout: 272 seconds]
<havenwood> erry: I commented on your gist.
duderonomy has joined #ruby
megamos has joined #ruby
catbusters has joined #ruby
duderonomy has quit [Client Quit]
<havenwood> erry: p method(:find_all).owner
<havenwood> erry: If it's not Enumerable: p method(:find_all).source_location
mayurvpatil has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
orbyt_ has joined #ruby
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
sarink has quit [Ping timeout: 258 seconds]
sarink has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
yokel has quit [Read error: Connection reset by peer]
yokel has joined #ruby
sarink has quit [Remote host closed the connection]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shaman42 has joined #ruby
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
sarink has joined #ruby
conta has joined #ruby
cow[moo] has joined #ruby
AndroidKitKat has joined #ruby
Snowy has quit [Quit: ragequit]
s3nd1v0g1us has joined #ruby
duderonomy has joined #ruby
sandstrom has joined #ruby
cisco has joined #ruby
gix has joined #ruby
mayurvpatil has quit [Quit: This computer has gone to sleep]
aupadhye has quit [Quit: Leaving]
<pinky> stupid question, when you have a class inside another class, can you access the class instance variables from the outer class?
AJA4350 has quit [Ping timeout: 258 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
<havenwood> pinky: You can only get at instance variables from within the instance where they were defined. Nested classes don't get any special exposure to instance variables.
<pinky> ah ok is there a common pattern used for that?
Nicmavr has joined #ruby
<havenwood> pinky: Show the code?
<pinky> i guess when i instantiate the inner class from the outer one i could pass self into it or something?
<pinky> hm thats hard to do
<havenwood> pinky: Why are there two classes? Do they share state?
<pinky> the inner ones are data containers
<pinky> so the outer one has an instance of faraday interacting with an api
<havenwood> Do they need to be nested? Why do they share state? Do they share concerns?
<pinky> hm they don't really share state
<havenwood> I'd suggest making it simpler, if you can. It'd help if we could see the code.
<pinky> a module can just have constants i guess?
<havenwood> The simplest thing that can possibly work is a good starting point.
<havenwood> Then refactor, only if it's an improvement.
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> pinky: Yes, a module can have constants.
<havenwood> pinky: Public by default, or private.
AJA4350 has joined #ruby
<pinky> so a constant wouldn't help me, the object i want available from the contained classes is a faraday object
<havenwood> pinky: Why can't you assign a constant to that Faraday client?
<havenwood> Is it open source?
absolutejam1 has joined #ruby
<pinky> i assume the variable i use to instantiate the faraday client can't be a constant
<pinky> i am typing up something now to share
conta has quit [Ping timeout: 258 seconds]
henninb has quit [Ping timeout: 248 seconds]
conta has joined #ruby
<ruby[bot]> pinky: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<pinky> something like that
absolutejam1 has quit [Ping timeout: 248 seconds]
<pinky> just edited it to show more
<pinky> so on line 9 i guess i could pass in the faraday object
<pinky> just was hoping for something cleaner
<pinky> if i didn't have these as classes inside the API class wouldn't i have the same issue? i guess i would need a global variable
<havenwood> pinky: From this, I can't see the need for more than one class. Maybe there are reasons beyond this code sample?
<pinky> what would you use instead of a class?
<havenwood> I guess there are multiple SpecificThing variants?
<pinky> yeah
<havenwood> pinky: Why have both API and API::GenericAPIThing? An API has multiple GenericAPIThings?
<pinky> no
<pinky> just i guess because most of the Things can share some methods
<pinky> so those go in GenericAPIThing
<havenwood> Why not just have those in API?
<havenwood> SpecificAPI < API
<pinky> hm, so i wouldn't have the same problem there?
<havenwood> it doesn't seem so to me, sec
<pinky> ah i guess i'd use a class variable and then have GenericAPIThings inherit API so then it'd be available
<havenwood> pinky: Commented on your gist.
<havenwood> pinky: I may just be not seeing the bigger picture, since this is so zoomed in. ¯\_(ツ)_/¯
<pinky> ah thanks that is helpful i think
s3nd1v0g1us has quit [Quit: WeeChat 2.4]
absolutejam1 has joined #ruby
iffraff has joined #ruby
greypack has joined #ruby
awhuac^ has joined #ruby
kyrylo has joined #ruby
tf2ftw has joined #ruby
<tf2ftw> Hi. I'm using Faraday in an api client. I'm using Mintiest and VCR to test with. I'm getting this warning when running the tests:
<tf2ftw> WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday 1.0.
<tf2ftw> I've done a bunch of googling but the answer isn't clicking with me. Anyone experience this?
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> tf2ftw: Here's a fix, for example: https://github.com/WeAreFarmGeek/diplomat/pull/149/files
<havenwood> tf2ftw: (Adapter last.)
<tf2ftw> Here's what I'm using
AJA4351 has joined #ruby
sauvin has quit [Ping timeout: 272 seconds]
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
<tf2ftw> here's the entire class
sandstrom has quit [Quit: My computer has gone to sleep.]
<havenwood> tf2ftw: An aside, but should line 3 be?: 'Accept-Charset' => 'utf-8' }.freeze
<tf2ftw> Indeed (hat tip)
jefffrails35 has quit [Quit: Leaving]
<havenwood> tf2ftw: Yeah, I don't see any middleware. Maybe VCR middleware is involved? I've not run into this.
sarink has quit [Ping timeout: 245 seconds]
<tf2ftw> That's what I was thinking too. However, when when I bundle console this (its a gem) and run it from there I still get the warning.. I'll keep digging. Thanks havenwood
kurko_ has joined #ruby
sarink has joined #ruby
<tf2ftw> Confirmed VCR is not loaded in bundle console.. hmm
kyrylo has joined #ruby
<havenwood> tf2ftw: I might try to step up the stack with byebug.
<havenwood> If you're using pry: https://github.com/deivid-rodriguez/pry-byebug
<tf2ftw> I am using pry so I guess that's my next step. I haven't used it beyond dropping into specific points so this will be a new learning experience :)
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
jacobnollette_ has joined #ruby
greypack has quit [Ping timeout: 248 seconds]
jacobnollette_ has quit [Client Quit]
greypack has joined #ruby
ajamieli` has joined #ruby
<greypack> hallo
ajamielittle has quit [Ping timeout: 252 seconds]
sarink has quit [Remote host closed the connection]
sarink has joined #ruby
<havenwood> greypack: hi
snigelfarfar_ has quit [Ping timeout: 268 seconds]
millerti has joined #ruby
queip has quit [Ping timeout: 244 seconds]
code_zombie has joined #ruby
NikhilSinghal has quit [Ping timeout: 252 seconds]
NikhilSinghal has joined #ruby
queip has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
absolutejam2 has joined #ruby
suukim has quit [Quit: Konversation terminated!]
absolutejam1 has quit [Ping timeout: 248 seconds]
AJA4351 has joined #ruby
sandstrom has joined #ruby
sarink has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
sarink has joined #ruby
sarink has quit [Remote host closed the connection]
matheusm1reira has joined #ruby
matheusmoreira has quit [Ping timeout: 258 seconds]
cd has joined #ruby
conta has quit [Quit: conta]
LtHummus has quit [Quit: ZNC 1.7.3 - https://znc.in]
queip has quit [Ping timeout: 272 seconds]
lxsameer has quit [Ping timeout: 248 seconds]
LtHummus has joined #ruby
queip has joined #ruby
_dbugger has quit [Quit: Leaving]
dviola has quit [Ping timeout: 245 seconds]
vjacob has joined #ruby
SegFaultAX has joined #ruby
reber has joined #ruby
deepreds1 has joined #ruby
GodFather has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ajamieli` has quit [Remote host closed the connection]
AJA4351 has joined #ruby
schne1der has quit [Ping timeout: 246 seconds]
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
oetjenj has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
ur5us has joined #ruby
jcalla has quit [Quit: Leaving]
<pinky> any way to indirect the instantiation of a class?
<pinky> like instead of Classname.new() you could do the equivalent of #{var}.new() where var contains the classname?
pabs has joined #ruby
<havenwood> pinky: Object.const_get(var).new
<pinky> ah sweet thanks :)
<havenwood> pinky: What canton7's link says
dviola has joined #ruby
brett-soric has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
<pinky> i wonder if theres a way to look in the namespace for class definitions and be able to find the ones that are a subclass of a particular one :)
<pinky> but that might just be crazy..
<phaul> &>> x = (rand < 0.5 ? Array : Hash); x.new
<rubydoc> # => {} (https://carc.in/#/r/76fn)
<phaul> &>> class X < (rand < 0.5 ? Array : Hash); end; X.new
<rubydoc> # => [] (https://carc.in/#/r/76fo)
<pinky> i guess it isn't self.const_get() ?
<pinky> i'm in an outer class and trying to dynamically instantiate one defined inside it
<pinky> oh i think it works with the actual name of the class not self
<phaul> You can look at ObjectSpace.each_object it even takes a superclass (optionally)
<pinky> nice thanks .. i think i figured this out, pretty sweet :)
<pinky> ruby has some nice stuff python doesn't have :P
<phaul> it's surprising sometimes how much is "just" code rather than special syntax
catbusters has quit [Quit: Connection closed for inactivity]
reber has quit [Remote host closed the connection]
absolutejam3 has joined #ruby
absolutejam2 has quit [Ping timeout: 268 seconds]
chalkmonster has joined #ruby
powerbit has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Fernando-Basso has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
emptyfl4sk has quit [Ping timeout: 272 seconds]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
<brool> i have a modular sinatra app i'm executing via rackup, so '/ttt' will run an instance of my sinatra app, in order that that app can treat '/ttt' as if it were root '/'. my problem is that, on the view i'm serving for "get '/'" in that app (which client-side looks like 'localhost/ttt') i am running javascript and calling fetch('/mlem'), which *would* work if the URI i ask to fetch() was requesting
<brool> "localhost/ttt/mlem" but it *actually* requests "localhost/mlem"
<brool> i've been reading about how fetch() works and people are saying it is supposed to treat URIs as relative paths, except in my case it's not and i assume that's because it's being served by sinatra which is responding to "get '/'" even though rackup is running that app in response to a request for "/ttt"
jordanm has quit [Remote host closed the connection]
jordanm has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
matheusm1reira is now known as matheusmoreira
brett-soric has left #ruby [#ruby]
lepepe has quit [Remote host closed the connection]
AJA4351 has joined #ruby
yokel has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 244 seconds]
AJA4351 is now known as AJA4350
lepepe_ has joined #ruby
yokel has joined #ruby
cisco has quit [Ping timeout: 248 seconds]
emptyfl4sk has joined #ruby
lepepe_ has quit [Ping timeout: 244 seconds]
snigelfarfar_ has joined #ruby
jordanm has quit [Remote host closed the connection]
orbyt_ has joined #ruby
nowhereman has joined #ruby
klaas has quit [Quit: ZNC 1.7.3 - https://znc.in]
klaas has joined #ruby
vondruch has quit [Ping timeout: 272 seconds]
renich has joined #ruby
chalkmonster has joined #ruby
<havenwood> brool: Can you?: set :public_folder, #...
emptyfl4sk has quit [Ping timeout: 272 seconds]
<havenwood> brool: Or I guess rather?: set :root, #...
<havenwood> brool: Or is NGINX/Apache handling public files?
RiPuk has joined #ruby
fphilipe_ has joined #ruby
ur5us has quit [Remote host closed the connection]
lepepe has joined #ruby
fphilipe_ has quit [Ping timeout: 252 seconds]
lepepe has quit [Ping timeout: 245 seconds]
r0ph has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
jordanm has joined #ruby
absolutejam3 has quit [Ping timeout: 248 seconds]
queip has quit [Ping timeout: 245 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
queip has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 258 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
sylario has quit [Quit: Connection closed for inactivity]
Sina has quit [Quit: Connection closed for inactivity]
dviola has quit [Changing host]
dviola has joined #ruby
DTZUZO has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mozzarella has quit [Quit: WeeChat 2.4]
lepepe has joined #ruby