« Back to channel list

#ruby - 03 July 2019

« Back 1 day Forward 1 day »
[00:01:11] orbyt_: has joined #ruby
[00:04:44] staticx: has joined #ruby
[00:05:17] chalkmonster: has joined #ruby
[00:09:12] emptyfl4sk: has joined #ruby
[00:21:09] havenwood: Looky there, it's master not trunk now: https://github.com/ruby/ruby/commit/f2769ae2c9f5c5a902584282f1e512437db1f395
[00:21:30] havenwood: And an alias for good measure: https://github.com/ruby/ruby/commit/7ff2bfed92f8017184963eaac13e75cfb5ce5d4a
[00:21:37] havenwood: The gitification seems complete.
[00:32:14] AlHafoudh: has joined #ruby
[00:57:11] Dr_MDMA_MD: has joined #ruby
[01:00:28] yokel: has joined #ruby
[01:04:54] emptyfl4sk: has joined #ruby
[01:19:08] fphilipe_: has joined #ruby
[01:21:04] FastJack: has joined #ruby
[01:22:05] henninb: has joined #ruby
[01:40:26] yokel: has joined #ruby
[01:41:09] henninb: has joined #ruby
[01:41:28] ur5us_: has joined #ruby
[01:46:20] henninb: has joined #ruby
[01:46:51] _dbugger: has joined #ruby
[01:57:46] henninb: has joined #ruby
[02:01:06] codefriar: has joined #ruby
[02:23:02] duderonomy: has joined #ruby
[02:25:05] FastJack: has joined #ruby
[02:29:34] pinky: has joined #ruby
[02:30:45] pinky: anyone seen any faraday middleware that can retry requests (connection refused, timeout) against a list of URLs?
[02:31:47] codefriar: has joined #ruby
[02:32:38] Swyper: has joined #ruby
[02:42:19] AlHafoudh: has joined #ruby
[02:48:37] r0ph: has joined #ruby
[02:48:42] r0ph: has joined #ruby
[02:52:04] henninb_: has joined #ruby
[02:56:48] Dr_MDMA_MD: has joined #ruby
[02:57:21] Swyper: has joined #ruby
[03:06:17] emptyfl4sk: has joined #ruby
[03:08:48] Technodrome: has joined #ruby
[03:09:23] braincrash: has joined #ruby
[03:13:04] sarink: has joined #ruby
[03:18:19] tdy: has joined #ruby
[03:21:09] fphilipe_: has joined #ruby
[03:25:24] Swyper: has joined #ruby
[03:27:31] Junaos: has joined #ruby
[03:29:25] sarink: has joined #ruby
[03:33:11] _whitelogger: has joined #ruby
[03:35:34] havenwood: pinky: Faraday can handle retries. By default, it just retries timeout exceptions.
[03:36:20] havenwood: pinky: You can pass it other exceptions.
[03:36:49] havenwood: pinky: Is there something about Faraday's retries that doesn't work for your case?
[03:42:41] emptyfl4sk: has joined #ruby
[03:55:12] codefriar: has joined #ruby
[04:19:19] tuor: has joined #ruby
[04:25:09] Fusl: has joined #ruby
[04:35:39] jmcgnh_: has joined #ruby
[04:44:50] greypack: has joined #ruby
[04:52:33] queip: has joined #ruby
[04:52:59] AlHafoudh: has joined #ruby
[04:53:39] fphilipe_: has joined #ruby
[04:55:15] Fusl: has joined #ruby
[05:00:27] yokel: has joined #ruby
[05:17:48] conta: has joined #ruby
[05:30:44] sarink: has joined #ruby
[05:44:10] emptyfl4sk: has joined #ruby
[05:44:39] absolutejam1: has joined #ruby
[05:46:28] fphilipe_: has joined #ruby
[05:55:19] sandstrom: has joined #ruby
[05:57:55] kyrylo: has joined #ruby
[06:08:14] schne1der: has joined #ruby
[06:18:17] sarink: has joined #ruby
[06:22:37] emptyfl4sk: has joined #ruby
[06:25:34] silviu: has joined #ruby
[06:28:51] rippa: has joined #ruby
[06:29:03] dionysus69: has joined #ruby
[06:29:17] rainer_tm: has joined #ruby
[06:30:07] shenghi: has joined #ruby
[06:31:56] aupadhye: has joined #ruby
[06:34:02] sauvin: has joined #ruby
[06:36:29] sarink: has joined #ruby
[06:36:44] cranq: has joined #ruby
[06:36:50] queip: has joined #ruby
[06:48:20] Megamos: has joined #ruby
[06:53:51] AlHafoudh: has joined #ruby
[06:57:31] Nicmavr: has joined #ruby
[06:57:53] suukim: has joined #ruby
[06:58:47] queip: has joined #ruby
[07:00:28] yokel: has joined #ruby
[07:04:57] lxsameer: has joined #ruby
[07:10:01] schne1der: has joined #ruby
[07:13:45] sarink: has joined #ruby
[07:15:59] mayurvpatil: has joined #ruby
[07:22:05] AlHafoudh: has joined #ruby
[07:30:12] ananth99: has joined #ruby
[07:32:06] dionysus69: has joined #ruby
[07:33:23] nomenkun: has joined #ruby
[07:33:57] deepreds1: has joined #ruby
[07:34:33] fphilipe_: has joined #ruby
[07:36:41] sarink: has joined #ruby
[07:40:03] mayurvpatil: has joined #ruby
[07:45:01] NL3limin4t0r: has joined #ruby
[07:45:44] ZAJDAN: what is the difference between cgi.params["dir"] ...and ... cgi["dir"]
[07:47:12] jmcgnh_: has joined #ruby
[07:51:53] jacksop: has joined #ruby
[07:57:12] havenwood: ZAJDAN: The latter returns only the first value, even if the former has many.
[07:57:15] havenwood: ZAJDAN: https://github.com/ruby/ruby/blob/trunk/lib/cgi/core.rb#L698-L718
[07:58:03] ZAJDAN: hawenwood: thank You
[07:58:24] ZAJDAN: in same way as in Ruby I can use CGI in Rails?
[08:00:30] deepreds1: has joined #ruby
[08:01:57] havenwood: ZAJDAN: Yeah, Rails is just Ruby.
[08:03:56] ZAJDAN: ok..thank YOu
[08:05:08] ZAJDAN: how I can extract first parameter 'dir' ? ...this come from AJAX: Parameters: {"dir"=>"6_BUGGY/", "onlyFolders"=>"false", "onlyFiles"=>"false", "multiSelect"=>"false"}
[08:06:18] deepreds1: has joined #ruby
[08:06:29] ZAJDAN: I am trying: if cgi.has_key?('dir') puts "is there" else dir = cgi.params["dir"].to_s end
[08:07:53] ZAJDAN: is possibe via CGI process aforesaid hash?
[08:13:44] absolutejam1: has joined #ruby
[08:14:52] mayurvpatil: has joined #ruby
[08:17:00] ellcs: has joined #ruby
[08:24:01] emptyfl4sk: has joined #ruby
[08:25:51] queip: has joined #ruby
[08:27:40] kyrylo: has joined #ruby
[08:45:06] absolutejam1: has joined #ruby
[08:49:33] jinie: has joined #ruby
[08:58:59] emptyfl4sk: has joined #ruby
[09:01:17] 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')`
[09:02:35] ZAJDAN: NL3: ye...right now I already tested it
[09:02:57] NL3limin4t0r: You could also use `has_key?` or `key?` instead of `include?`
[09:03:02] ZAJDAN: dir = (params[:dir])
[09:03:26] NL3limin4t0r: But RoR stuff should be in the #RubyOnRails channel.
[09:20:41] queip: has joined #ruby
[09:22:24] ryouba: has joined #ruby
[09:23:13] ryouba: is there something like Hash#||+= or if not, what's the most concise way of expressing that?
[09:23:59] ryouba: i.e. `foo ||= Hash.new; foo[:blah] ||+= 1`
[09:25:56] ryouba: (my current code is https://gist.github.com/sixtyfive/f79dfc1e5ad2ad7f62b682d989919120 and i'm wondering if there's a prettier way of writing that)
[09:26:01] ur5us: has joined #ruby
[09:27:16] balo: ryouba: unrelated but as a first suggestion, avoid using unless + else
[09:27:52] phaul: a [op]= b is a syntactic sugar for a = a [op] b. there is no sugar for multiple ops prefixing the =
[09:28:54] 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
[09:28:54] ryouba: balo: hmm, why?
[09:28:56] balo: also you can set a default value for Hash, like: stats ||= Hash.new(0); stats[:foo] += 1
[09:30:01] 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
[09:31:02] ryouba: hmm we have a Ruby execution bot in here, right?
[09:31:06] balo: because it's confusing :D https://github.com/rubocop-hq/ruby-style-guide#no-else-with-unless
[09:31:35] ryouba: oh okay, that *is* a good argument
[09:31:59] ryouba: i actually confused myself for a second when i wrote it
[09:32:14] ryouba: ACTION scratches head and wonders why head loves complexity so much
[09:32:45] balo: if you don't want to write `if !err` and you use rails, you can try `if err.blank?` to keep it nice
[09:34:32] 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
[09:34:55] chens: has joined #ruby
[09:35:22] ryouba: i do usually monkey patch #blank? into basically everything, though, because i find it helpful.
[09:36:42] pwnd_nsfw: has joined #ruby
[09:43:18] queip: has joined #ruby
[09:47:09] balo: yeah, it should be part of the stdlib i think, implemented natively. there is a reason why fast_blank exists
[09:53:49] Dbugger: has joined #ruby
[09:57:35] absolutejam1: has joined #ruby
[09:59:08] mayurvpatil: has joined #ruby
[10:00:38] _dbugger: has joined #ruby
[10:00:43] ryouba: !Hash.new == Hash.new(0)
[10:00:46] mikecmpbll: has joined #ruby
[10:00:54] ryouba: hmm, okay, that's *not* how to use the bot
[10:01:05] ryouba: balo: seconded, and thirded, and fourthed.
[10:03:10] 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.
[10:03:12] AlHafoudh: has joined #ruby
[10:03:54] sarink: has joined #ruby
[10:04:29] ryouba: phaul: you're right, it would at the very least be ambiguous.
[10:06:06] ryouba: btw, balo: https://rubystyle.guide/
[10:13:18] AlHafoudh: has joined #ruby
[10:17:51] sarink: has joined #ruby
[10:20:43] sarink: has joined #ruby
[10:27:26] conta: has joined #ruby
[10:29:05] balo: it's the same as the rubocop readme. just more fancier i guess
[10:30:26] AlHafoudh: has joined #ruby
[10:33:46] absolutejam1: has joined #ruby
[10:42:38] AlHafoudh: has joined #ruby
[10:45:47] howdoi: has joined #ruby
[10:54:06] mayurvpatil: has joined #ruby
[10:56:44] conta: has joined #ruby
[11:00:57] emptyfl4sk: has joined #ruby
[11:05:01] Raboo: has joined #ruby
[11:07:10] reber: has joined #ruby
[11:07:13] reber_: has joined #ruby
[11:12:01] Cthulu201: has joined #ruby
[11:15:22] ryouba: balo: yes, a little more digestible as an evening lecture
[11:19:14] vondruch: has joined #ruby
[11:26:58] absolutejam1: has joined #ruby
[11:32:40] emptyfl4sk: has joined #ruby
[11:32:46] ZAJDAN: how to append a string to variable? means something like has PHP: somevariable = " string"; somevariable .= "next string";
[11:36:56] ZAJDAN: I foundit .concat is the right way
[11:48:24] 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`
[11:52:15] 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"`
[11:53:09] NL3limin4t0r: Or if you don't mind mutating the original string: `string << "new addition"`
[11:58:36] ZAJDAN: name of method can be camelCase ?
[12:00:17] absolutejam1: has joined #ruby
[12:08:53] conta: has joined #ruby
[12:10:48] absolutejam1: has joined #ruby
[12:24:38] balo: ZAJDAN: yes, but it shouldn't https://rubystyle.guide/#snake-case-symbols-methods-vars
[12:25:27] dhollinger: has joined #ruby
[12:28:30] conta: has joined #ruby
[12:30:35] NL3limin4t0r: Ruby itself uses snakecase and for consistency sake that is what is recommended in the style guide ^
[12:32:50] NL3limin4t0r: Examples are: Array#delete_if, Module#append_features, Hash#has_key?
[12:42:03] pinky: havenwood: sorry was in bed .. i wanted to retry but with a different URL
[12:43:24] dhollinger: has joined #ruby
[12:52:16] tuor: has joined #ruby
[13:00:27] yokel: has joined #ruby
[13:06:56] codefriar: has joined #ruby
[13:15:31] dviola: has joined #ruby
[13:15:36] henninb: has joined #ruby
[13:18:10] jinie: has joined #ruby
[13:20:40] al-damiri: has joined #ruby
[13:31:56] henninb: has joined #ruby
[13:33:50] lucasb: has joined #ruby
[13:34:08] emptyfl4sk: has joined #ruby
[13:37:48] AJA4350: has joined #ruby
[13:42:17] vondruch: has joined #ruby
[13:42:33] Swyper: has joined #ruby
[13:45:08] snigelfarfar_: has joined #ruby
[13:47:21] snigelfarfar_: test = "test"; test.each_char{|g| test.reverse.chomp(g)}
[13:47:39] snigelfarfar_: why doesnt this work as anticipated
[13:48:17] snigelfarfar_: test should be empty but test = "test"
[13:49:50] Lyubo1: has joined #ruby
[13:50:32] phaul: each_char returns what
[13:50:48] phaul: was the receiver if black was given
[13:52:07] phaul: &>> 'hello'.each_char { 'doesnt_matter_what_this_is' }
[13:52:09] rubydoc: # => "hello" (https://carc.in/#/r/76cz)
[13:52:39] Inline: has joined #ruby
[13:53:46] phaul: you can chain a #map on it as it returns an Enumerator if no block was given
[13:54:37] kyrylo: has joined #ruby
[13:55:05] absolutejam1: has joined #ruby
[13:58:01] sarink: has joined #ruby
[13:58:30] phaul: &>> test = "test"; test.each_char.map { |g| test.reverse.chomp(g) }
[13:58:30] rubydoc: # => ["tse", "tset", "tset", "tse"] (https://carc.in/#/r/76d4)
[14:01:10] spiette: has joined #ruby
[14:03:54] vondruch_: has joined #ruby
[14:06:41] sarink: has joined #ruby
[14:10:12] emptyfl4sk: has joined #ruby
[14:10:36] Swyper: has joined #ruby
[14:13:45] havenwood: Interesting to see Tokaido back alive with 2.6 support!
[14:21:42] brool: has joined #ruby
[14:26:06] irc_chat: has joined #ruby
[14:26:10] Megamos: has joined #ruby
[14:26:56] conta: has joined #ruby
[14:29:46] 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.
[14:34:00] englishm: has joined #ruby
[14:35:57] NL3limin4t0r: &>> test = 'test'; test.each_char { |char| test.reverse!.chomp!(char) }
[14:36:04] rubydoc: # => "es" (https://carc.in/#/r/76db)
[14:36:16] queip: has joined #ruby
[14:36:48] NL3limin4t0r: Keep in mind that iterating over an collection and modifying it at the same time might yield unexpected results.
[14:37:40] Swyper: has joined #ruby
[14:39:17] 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.
[14:44:22] NL3limin4t0r: &>> test = 'test'; test.dup.each_char { |char| test.reverse!.chomp!(char) }
[14:44:23] rubydoc: # => "test" (https://carc.in/#/r/76dc)
[14:44:36] NL3limin4t0r: &>> test = 'test'; test.dup.each_char { |char| test.reverse!.chomp!(char) }; test
[14:44:40] rubydoc: # => "es" (https://carc.in/#/r/76dd)
[14:45:15] absolutejam1: has joined #ruby
[14:46:38] irc_chat: has left #ruby: ()
[14:50:48] Fired_Fart: has joined #ruby
[14:53:23] mayurvpatil: has joined #ruby
[14:54:14] troulouliou_div2: has joined #ruby
[14:56:09] schne1der: has joined #ruby
[15:00:23] orbyt_: has joined #ruby
[15:00:29] yokel: has joined #ruby
[15:10:09] ajamielittle: has joined #ruby
[15:19:09] Quintasan: has joined #ruby
[15:19:09] Quintasan: has joined #ruby
[15:25:46] AndroidKitKat: has left #ruby: ("Leaving")
[15:32:05] queip: has joined #ruby
[15:33:38] absolutejam1: has joined #ruby
[15:39:50] orbyt_: has joined #ruby
[15:47:33] Sylario: has joined #ruby
[15:47:48] Mrgoose8: has joined #ruby
[15:55:52] sarink: has joined #ruby
[16:04:21] lepepe: has joined #ruby
[16:04:23] duderonomy: has joined #ruby
[16:04:26] erry: has joined #ruby
[16:04:39] erry: is "foo if bar else baz" a thing?
[16:04:46] erry: i see it all oer some code
[16:04:49] erry: it's symntax erroring
[16:04:52] erry: i know exactly 0 ruby
[16:04:57] erry: i don't understand how that works
[16:06:34] ytti: where exactly do you see it, do you have a link to a line in github
[16:07:08] ytti: in python that would be thing, but not in ruby
[16:08:36] erry: let me paste..
[16:08:52] ytti: bar ? foo : baz
[16:08:54] ytti: would be ruby equivalent
[16:09:09] erry: https://gist.github.com/errietta/9e40319dbf3b77d219e284504459f80b
[16:09:29] erry: lines 9-11 i guess
[16:09:43] ytti: it doesn't do what you asked tho
[16:09:54] erry: what does it do?
[16:09:55] ytti: it has two conditions, your ask has true and false branch
[16:10:07] Mrgoose8: has joined #ruby
[16:10:08] ytti: if both conditinos are true it returns true
[16:10:24] ytti: that is really odd awkard code tho
[16:10:32] erry: it's syntax erroring for me
[16:10:38] erry: which is weird because i assume it works for someone
[16:10:45] erry: it's been in our codebase for months
[16:11:00] erry: it's not written by programmers
[16:11:51] ytti: the code is
[16:11:54] ytti: def method
[16:12:02] ytti: it's not else on the return line
[16:12:21] erry: what's it else-ing
[16:12:37] ytti: it's no-op in that code
[16:12:58] ytti: it could be removed with no change to code
[16:13:25] ytti: it only make sense in context of rescue
[16:13:27] ytti: def method
[16:13:32] ytti: rescue some_Error
[16:13:38] ytti: we didnt need rescue
[16:13:46] havenwood: +1 that it looks like a rescue was removed.
[16:14:01] havenwood: erry: rescue/else is the only context this would make sense, and the indentation confirms.
[16:14:06] emptyfl4sk: has joined #ruby
[16:14:16] havenwood: erry: Where'd the rescue go?
[16:15:56] erry: thjat'd explain "else without rescue is useless"
[16:16:14] 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
[16:16:18] psilly0: has joined #ruby
[16:16:29] erry: thanks.. i get it now
[16:16:36] erry: why is this a thing *sob*
[16:16:44] ytti: there are, unfortunately, many thing in that short piece of code which communicates that person isn't particularly familiar with ruby
[16:16:53] erry: ytti: it's written by qa engineers
[16:16:59] duderonomy: has joined #ruby
[16:17:00] erry: i don't know why they picked a relatively difficult language
[16:17:05] erry: they can't really code
[16:17:55] AJA4351: has joined #ruby
[16:18:29] havenwood: erry: Is this Rails code?
[16:18:38] snowy: has joined #ruby
[16:18:59] erry: havenwood: no it's tests with cucumber and what not
[16:19:06] erry: there's no rails involved
[16:19:15] DarthGandalf: has joined #ruby
[16:22:26] havenwood: erry: I was just going to suggest different changes if it was Rails.
[16:22:48] havenwood: erry: Is that really meant to be the second index for `new_send_invite_btn` and `new_added_email`?
[16:28:19] havenwood: erry: I commented on your gist.
[16:28:30] duderonomy: has joined #ruby
[16:29:39] Megamos: has joined #ruby
[16:31:01] catbusters: has joined #ruby
[16:32:51] havenwood: erry: p method(:find_all).owner
[16:33:02] havenwood: erry: If it's not Enumerable: p method(:find_all).source_location
[16:40:15] mayurvpatil: has joined #ruby
[16:43:05] cow[moo]: has joined #ruby
[16:46:35] orbyt_: has joined #ruby
[16:49:04] sarink: has joined #ruby
[16:56:01] sarink: has joined #ruby
[17:00:26] yokel: has joined #ruby
[17:01:53] shaman42: has joined #ruby
[17:02:05] cow[moo]: has joined #ruby
[17:04:32] sarink: has joined #ruby
[17:05:58] conta: has joined #ruby
[17:05:59] cow[moo]: has joined #ruby
[17:08:10] AndroidKitKat: has joined #ruby
[17:13:14] s3nd1v0g1us: has joined #ruby
[17:14:42] duderonomy: has joined #ruby
[17:17:12] havenwood: https://cfp.rubycentral.org/events/rubyconf2019
[17:17:53] sandstrom: has joined #ruby
[17:18:13] cisco: has joined #ruby
[17:20:39] gix: has joined #ruby
[17:25:11] pinky: stupid question, when you have a class inside another class, can you access the class instance variables from the outer class?
[17:26:44] 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.
[17:27:20] pinky: ah ok is there a common pattern used for that?
[17:27:41] Nicmavr: has joined #ruby
[17:27:46] havenwood: pinky: Show the code?
[17:28:03] pinky: i guess when i instantiate the inner class from the outer one i could pass self into it or something?
[17:28:06] pinky: hm thats hard to do
[17:28:18] havenwood: pinky: Why are there two classes? Do they share state?
[17:28:31] pinky: the inner ones are data containers
[17:29:13] pinky: so the outer one has an instance of faraday interacting with an api
[17:29:18] havenwood: Do they need to be nested? Why do they share state? Do they share concerns?
[17:29:43] pinky: hm they don't really share state
[17:29:46] havenwood: I'd suggest making it simpler, if you can. It'd help if we could see the code.
[17:30:09] pinky: a module can just have constants i guess?
[17:30:14] havenwood: The simplest thing that can possibly work is a good starting point.
[17:30:25] havenwood: Then refactor, only if it's an improvement.
[17:30:45] havenwood: pinky: Yes, a module can have constants.
[17:30:58] havenwood: pinky: Public by default, or private.
[17:31:04] AJA4350: has joined #ruby
[17:31:22] pinky: so a constant wouldn't help me, the object i want available from the contained classes is a faraday object
[17:31:55] havenwood: pinky: Why can't you assign a constant to that Faraday client?
[17:32:20] havenwood: Is it open source?
[17:32:36] absolutejam1: has joined #ruby
[17:33:28] pinky: i assume the variable i use to instantiate the faraday client can't be a constant
[17:33:33] pinky: i am typing up something now to share
[17:34:06] conta: has joined #ruby
[17:35:43] pinky: havenwood: https://pastebin.com/LXtnqRhA
[17:35:43] 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
[17:35:44] pinky: something like that
[17:36:21] pinky: https://gist.github.com/pxnky/9517dfa2b9be2ea676cc059df46e5957
[17:38:28] pinky: just edited it to show more
[17:38:42] pinky: so on line 9 i guess i could pass in the faraday object
[17:38:54] pinky: just was hoping for something cleaner
[17:42:12] 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
[17:44:47] havenwood: pinky: From this, I can't see the need for more than one class. Maybe there are reasons beyond this code sample?
[17:45:18] pinky: what would you use instead of a class?
[17:45:22] havenwood: I guess there are multiple SpecificThing variants?
[17:45:51] havenwood: pinky: Why have both API and API::GenericAPIThing? An API has multiple GenericAPIThings?
[17:46:22] pinky: just i guess because most of the Things can share some methods
[17:46:27] pinky: so those go in GenericAPIThing
[17:46:38] havenwood: Why not just have those in API?
[17:46:48] havenwood: SpecificAPI < API
[17:47:37] pinky: hm, so i wouldn't have the same problem there?
[17:47:56] havenwood: it doesn't seem so to me, sec
[17:51:17] pinky: ah i guess i'd use a class variable and then have GenericAPIThings inherit API so then it'd be available
[17:52:00] havenwood: pinky: Commented on your gist.
[17:52:35] havenwood: pinky: I may just be not seeing the bigger picture, since this is so zoomed in. ¯\_(ツ)_/¯
[17:52:54] pinky: ah thanks that is helpful i think
[18:07:11] absolutejam1: has joined #ruby
[18:19:32] iffraff: has joined #ruby
[18:20:26] greypack: has joined #ruby
[18:23:44] awhuac^: has joined #ruby
[18:25:03] kyrylo: has joined #ruby
[18:26:36] tf2ftw: has joined #ruby
[18:27:56] 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:
[18:27:56] tf2ftw: WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday 1.0.
[18:27:56] tf2ftw: I've done a bunch of googling but the answer isn't clicking with me. Anyone experience this?
[18:29:28] cow[moo]: has joined #ruby
[18:31:44] havenwood: tf2ftw: Here's a fix, for example: https://github.com/WeAreFarmGeek/diplomat/pull/149/files
[18:31:56] havenwood: tf2ftw: (Adapter last.)
[18:32:56] tf2ftw: Here's what I'm using
[18:32:57] tf2ftw: https://dpaste.de/J4eU
[18:33:02] AJA4351: has joined #ruby
[18:35:44] tf2ftw: here's the entire class
[18:35:45] tf2ftw: https://dpaste.de/f9rp
[18:37:59] havenwood: tf2ftw: An aside, but should line 3 be?: 'Accept-Charset' => 'utf-8' }.freeze
[18:38:33] tf2ftw: Indeed (hat tip)
[18:38:50] havenwood: tf2ftw: Yeah, I don't see any middleware. Maybe VCR middleware is involved? I've not run into this.
[18:39:44] 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
[18:40:10] kurko_: has joined #ruby
[18:41:22] sarink: has joined #ruby
[18:42:29] tf2ftw: Confirmed VCR is not loaded in bundle console.. hmm
[18:42:37] kyrylo: has joined #ruby
[18:43:47] havenwood: tf2ftw: I might try to step up the stack with byebug.
[18:44:08] havenwood: If you're using pry: https://github.com/deivid-rodriguez/pry-byebug
[18:45:24] 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 :)
[19:00:47] yokel: has joined #ruby
[19:00:57] jacobnollette_: has joined #ruby
[19:04:34] greypack: has joined #ruby
[19:04:41] ajamieli`: has joined #ruby
[19:06:58] sarink: has joined #ruby
[19:10:31] havenwood: greypack: hi
[19:20:41] millerti: has joined #ruby
[19:22:39] code_zombie: has joined #ruby
[19:26:09] NikhilSinghal: has joined #ruby
[19:26:49] queip: has joined #ruby
[19:32:41] absolutejam2: has joined #ruby
[19:39:39] AJA4351: has joined #ruby
[19:40:07] sandstrom: has joined #ruby
[19:42:33] sarink: has joined #ruby
[19:51:27] matheusm1reira: has joined #ruby
[19:53:47] cd: has joined #ruby
[20:09:11] LtHummus: has joined #ruby
[20:10:31] queip: has joined #ruby
[20:15:06] vjacob: has joined #ruby
[20:25:58] SegFaultAX: has joined #ruby
[20:32:47] reber: has joined #ruby
[20:38:37] deepreds1: has joined #ruby
[20:39:41] GodFather: has joined #ruby
[20:46:17] AJA4351: has joined #ruby
[20:49:39] oetjenj: has joined #ruby
[21:00:28] yokel: has joined #ruby
[21:01:46] ur5us: has joined #ruby
[21:03:31] pinky: any way to indirect the instantiation of a class?
[21:04:16] pinky: like instead of Classname.new() you could do the equivalent of #{var}.new() where var contains the classname?
[21:04:33] pabs: has joined #ruby
[21:05:01] canton7: pinky, https://stackoverflow.com/a/5924541/1086121
[21:05:23] havenwood: pinky: Object.const_get(var).new
[21:05:35] pinky: ah sweet thanks :)
[21:05:49] havenwood: pinky: What canton7's link says
[21:07:42] dviola: has joined #ruby
[21:08:03] brett-soric: has joined #ruby
[21:10:22] 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 :)
[21:10:25] pinky: but that might just be crazy..
[21:12:18] phaul: &>> x = (rand < 0.5 ? Array : Hash); x.new
[21:12:18] rubydoc: # => {} (https://carc.in/#/r/76fn)
[21:13:29] phaul: &>> class X < (rand < 0.5 ? Array : Hash); end; X.new
[21:13:30] rubydoc: # => [] (https://carc.in/#/r/76fo)
[21:13:55] pinky: i guess it isn't self.const_get() ?
[21:14:11] pinky: i'm in an outer class and trying to dynamically instantiate one defined inside it
[21:15:47] pinky: oh i think it works with the actual name of the class not self
[21:16:16] phaul: You can look at ObjectSpace.each_object it even takes a superclass (optionally)
[21:17:07] pinky: nice thanks .. i think i figured this out, pretty sweet :)
[21:17:13] pinky: ruby has some nice stuff python doesn't have :P
[21:18:17] phaul: it's surprising sometimes how much is "just" code rather than special syntax
[21:20:47] absolutejam3: has joined #ruby
[21:24:49] chalkmonster: has joined #ruby
[21:27:02] Fernando-Basso: has joined #ruby
[21:36:19] oetjenj: has joined #ruby
[21:37:08] oetjenj: has joined #ruby
[21:37:56] oetjenj: has joined #ruby
[21:38:38] oetjenj: has joined #ruby
[21:39:25] oetjenj: has joined #ruby
[21:40:17] oetjenj: has joined #ruby
[21:40:59] oetjenj: has joined #ruby
[21:41:50] oetjenj: has joined #ruby
[21:43:53] 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
[21:43:55] brool: "localhost/ttt/mlem" but it *actually* requests "localhost/mlem"
[21:45:50] 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"
[21:47:13] jordanm: has joined #ruby
[21:55:33] brett-soric: has left #ruby: ()
[21:57:39] AJA4351: has joined #ruby
[22:00:07] lepepe_: has joined #ruby
[22:00:27] yokel: has joined #ruby
[22:02:39] emptyfl4sk: has joined #ruby
[22:04:39] snigelfarfar_: has joined #ruby
[22:14:53] orbyt_: has joined #ruby
[22:15:14] nowhereman: has joined #ruby
[22:31:05] klaas: has joined #ruby
[22:39:10] Renich: has joined #ruby
[22:43:05] chalkmonster: has joined #ruby
[22:44:03] havenwood: brool: Can you?: set :public_folder, #...
[22:44:34] havenwood: brool: Or I guess rather?: set :root, #...
[22:44:56] havenwood: brool: Or is NGINX/Apache handling public files?
[22:45:46] RiPuk: has joined #ruby
[22:46:42] fphilipe_: has joined #ruby
[22:50:13] lepepe: has joined #ruby
[23:00:30] ur5us: has joined #ruby
[23:00:42] jordanm: has joined #ruby
[23:04:48] AJA4351: has joined #ruby
[23:10:13] queip: has joined #ruby
[23:36:12] dviola: has joined #ruby
[23:37:14] DTZUZO: has joined #ruby
[23:59:31] lepepe: has joined #ruby