« Back to channel list

#ruby - 23 April 2019

« Back 1 day
[00:00:23] ramfjord: has joined #ruby
[00:24:56] orbyt_: has joined #ruby
[00:25:00] havenwood: Progress! https://www.ruby-lang.org/en/news/2019/04/23/move-to-git-from-svn/
[00:34:40] tdy: has joined #ruby
[00:34:41] fphilipe_: has joined #ruby
[00:35:45] jottr: has joined #ruby
[00:39:04] adam12: havenwood: Yess!!
[00:39:42] adam12: Tho I've noticed they're reasonably accepting to PRs through Github.
[00:39:44] darris: has joined #ruby
[00:40:02] agent_white: has joined #ruby
[00:40:21] al2o3-cr: has joined #ruby
[00:52:12] AJA4351: has joined #ruby
[00:56:51] Swyper_: has joined #ruby
[01:14:01] orbyt_: has joined #ruby
[01:15:32] Swyper: has joined #ruby
[01:23:58] Swyper: has joined #ruby
[01:25:18] Swyper_: has joined #ruby
[01:25:43] weteamsteve1: has joined #ruby
[01:26:05] AJA4351: has joined #ruby
[01:35:11] fphilipe_: has joined #ruby
[01:43:28] bambanx: has joined #ruby
[01:47:40] mangold: has joined #ruby
[02:14:19] weteamsteve2: has joined #ruby
[02:26:41] weteamsteve1: has joined #ruby
[02:32:09] agent_white: has joined #ruby
[02:32:39] dsmythe: has joined #ruby
[02:40:02] doodlebug: has joined #ruby
[02:43:51] jottr: has joined #ruby
[02:45:21] fphilipe_: has joined #ruby
[02:45:32] Xeago: has joined #ruby
[02:46:03] doodlebug: has joined #ruby
[02:52:03] doodlebug: has joined #ruby
[03:09:13] braincrash: has joined #ruby
[03:15:10] duderonomy: has joined #ruby
[03:21:12] _whitelogger: has joined #ruby
[03:25:09] envex: has joined #ruby
[04:00:37] jottr: has joined #ruby
[04:06:32] yield: has joined #ruby
[04:09:26] buckworst: has joined #ruby
[04:11:27] mangold: has joined #ruby
[04:20:48] planigan: has joined #ruby
[04:25:22] fphilipe_: has joined #ruby
[04:47:37] sauvin: has joined #ruby
[04:48:27] mangold: has joined #ruby
[04:50:46] Swyper: has joined #ruby
[05:13:27] kapil____: has joined #ruby
[05:14:21] ramfjord: has joined #ruby
[05:28:56] jenrzzz: has joined #ruby
[05:34:23] tdy1: has joined #ruby
[05:37:03] conta: has joined #ruby
[05:40:47] vondruch: has joined #ruby
[05:52:18] spacesuitdiver: has joined #ruby
[05:53:09] conta1: has joined #ruby
[05:56:15] crankharder: has joined #ruby
[06:06:56] jenrzzz: has joined #ruby
[06:10:06] jottr: has joined #ruby
[06:14:04] conta: has joined #ruby
[06:16:20] xlued: has joined #ruby
[06:22:41] rafadc: has joined #ruby
[06:23:01] olspookishmagus: has joined #ruby
[06:48:25] schleppel: has joined #ruby
[06:58:52] DTZUZO: has joined #ruby
[06:59:01] aupadhye: has joined #ruby
[06:59:57] aupadhye: has joined #ruby
[07:00:07] fphilipe_: has joined #ruby
[07:06:22] wildermind: has joined #ruby
[07:14:35] ramfjord: has joined #ruby
[07:17:07] nones: has joined #ruby
[07:18:12] laaron: has joined #ruby
[07:22:23] clemens3_: has joined #ruby
[07:23:21] jefffrails35: has joined #ruby
[07:27:05] dionysus69: adam12: I will post a snippet one sec
[07:33:02] dionysus69: adam12: so here it is https://gist.github.com/webzorg/e4f5ca2dc9d54be25e8d92186a21e4aa
[07:36:26] dionysus69: line 60, json['params'], = *args so I assume this works like the following: we are dealing with mass assignment but only with one variable, first element of the array args gets assigned to json["params"], I just dont get why I cant just assign splatted array to the params as hash
[07:42:49] dionysus69: I also have one more question to everyone about monkey patching. So I am monkey patching a gem which pretty much has a single file and I am just changing this line 60, so I am basically only monkey patching method_missing method on line 37 in the link I posted. but when I insert this code RPC > JSON > Client > def method_missing other methods do not get inherited from the gem, so I am forced to copy all methods
[07:42:52] dionysus69: in the file just to monkey patch single method
[07:43:26] dionysus69: AFAIK, it is supposed to inherit everything else from the gem, and just shadow/override the monkey patched method
[07:48:43] lxsameer: has joined #ruby
[07:49:18] dsmythe: has joined #ruby
[07:57:12] jottr: has joined #ruby
[07:58:07] conta: has joined #ruby
[08:09:51] jenrzzz: has joined #ruby
[08:12:13] jottr: has joined #ruby
[08:20:56] conta: has joined #ruby
[08:23:28] Swyper: has joined #ruby
[08:29:01] gregf_: has joined #ruby
[08:30:23] alem0lars: has joined #ruby
[08:32:07] reber: has joined #ruby
[08:38:55] ryouba: good mornign!
[08:41:03] kyrylo: has joined #ruby
[08:44:51] laaron: has joined #ruby
[08:47:23] ryouba: when using something like regosaurs=[/(?<blah>\d+)/, /(?<boobledeedoop>[[:punct:]]/]; regosaurs.all? {|r| r.match? "99 bottles of beer."} ... is there any way i can access the matching groups' contents (blah: 99, boobledeedoop: '.') later?
[08:47:47] jottr: has joined #ruby
[08:52:14] ryouba: hmm, foo=[];regosaurs=[/(?<blah>\d+)/, /(?<boobledeedoop>[[:punct:]])/]; regosaurs.all? {|r| foo << "99 bottles of beer.".match(r); foo.any?} works. not much elegant though.
[08:56:25] ellcs: has joined #ruby
[08:56:38] za1b1tsu: has joined #ruby
[09:02:22] dsmythe: has joined #ruby
[09:04:12] ryouba: hah! got it! regosaurs=[/(?<blah>\d+)/, /(?<boobledeedoop>[[:punct:]])/]; regosaurs.map {|r| "99 bottles of beer.".match(r).named_captures}.inject :merge
[09:07:11] ujjain-: has joined #ruby
[09:08:15] ryouba: unfortunately doesn't work when some are nil :-(
[09:08:16] gregf_: has joined #ruby
[09:12:04] prestorium: has joined #ruby
[09:12:30] ryouba: YAY!!! regosaurs=[/(?<blah>\d+)/, /(?<boobledeedoop>[[:punct:]])/]; matches=regosaurs.map {|r| "99 bottles of beer.".match(r)&.named_captures}.compact.inject :merge
[09:15:23] jenrzzz: has joined #ruby
[09:19:20] queip: has joined #ruby
[09:20:06] crankharder: has joined #ruby
[09:21:30] phaul: has joined #ruby
[09:40:42] ryouba: hi phaul :)
[09:40:58] phaul: hi ryouba :)
[09:41:09] phaul: how's it going?
[09:43:14] jottr: has joined #ruby
[09:45:32] laaron: has joined #ruby
[09:48:20] ryouba: phaul: quite well, i just figured out "regosaurs=[/(?<blah>\d+)/, /(?<boobledeedoop>[[:punct:]])/]; matches=regosaurs.map {|r| "99 bottles of beer.".match(r)&.named_captures}.compact.inject :merge" before you came, which makes me happy :)
[09:48:23] ryouba: how are you?
[09:50:21] phaul: that's cool, not too bad myself, thank you.
[09:53:39] ralt: has joined #ruby
[09:55:05] ralt: is it normal that the git tags on the upstream git repository have disappeared?
[09:56:28] ryouba: phaul: what time zone are you in btw?
[09:56:39] phaul: ryouba: CET
[09:57:23] ryouba: oh, just a little bit west of me then :)
[10:00:15] ralt: we were using the git tags to build a custom version of upstream versions but no longer can. I assume it's related to the change from svn to git, but it feels weird, and not necessarily on purpose, to delete the tags. How do you know which commit to build your release tarballs on?
[10:02:01] danielsju6: has joined #ruby
[10:02:04] danielz1: has joined #ruby
[10:02:41] danielsju6: has joined #ruby
[10:04:39] olblak: has joined #ruby
[10:04:56] mangold: has joined #ruby
[10:05:23] ferr: has joined #ruby
[10:07:55] maleghast: has joined #ruby
[10:10:50] conta: has joined #ruby
[10:11:51] maleghast: has joined #ruby
[10:13:34] dsmythe: has joined #ruby
[10:20:37] AJA4350: has joined #ruby
[10:23:08] conta: has joined #ruby
[10:41:37] Swyper: has joined #ruby
[10:44:10] wald0: has joined #ruby
[10:44:48] _joes_: has joined #ruby
[10:53:49] tdy1: has joined #ruby
[10:54:05] AJA4351: has joined #ruby
[10:55:16] dostoyevsky: has joined #ruby
[10:55:59] dostoyevsky: has joined #ruby
[11:01:55] Swyper: has joined #ruby
[11:03:31] GodFather: has joined #ruby
[11:07:40] conta: has joined #ruby
[11:08:45] Swyper: has joined #ruby
[11:09:21] dostoyevsky: has joined #ruby
[11:15:00] ramfjord: has joined #ruby
[11:15:36] jenrzzz: has joined #ruby
[11:19:55] Swyper: has joined #ruby
[11:26:13] conta: has joined #ruby
[11:34:11] old_relik: has joined #ruby
[11:34:44] ldnunes: has joined #ruby
[11:34:55] mikeiniowa: has joined #ruby
[11:35:10] old_relik: is there a better way of writing this fn https://dpaste.de/iref
[11:35:33] AJA4350: has joined #ruby
[11:36:18] havenwood: old_relik: Rails?
[11:36:53] old_relik_: has joined #ruby
[11:36:54] canton7: old_relik, this is equivalent: https://dpaste.de/VZwO
[11:37:57] old_relik_: didn't like that return at the end
[11:38:05] havenwood: old_relik: I'd suggest extracting `details` to a frozen constant.
[11:38:21] havenwood: old_relik_: Usually, DateTime.current is best in Rails (has TZ).
[11:38:34] old_relik_: that makes sense
[11:38:40] old_relik_: can't extract details
[11:38:45] old_relik_: it's populated via params
[11:38:58] old_relik_: oh, you mean an unpopulated constant
[11:39:02] havenwood: old_relik_: ah, didn't notice that
[11:39:09] havenwood: no, i'm just blind
[11:39:11] wildermind: Hi, I installed `rvm` and then typed `sudo rvm install puppet -v 3.8.7` and all went find but when I type `puppet --version` I get the following error: https://pastebin.ubuntu.com/p/jD76NFzjqk/
[11:39:25] wildermind: help? :) Im only using rvm to install puppter
[11:39:26] old_relik_: that's not what I meant
[11:39:38] dionysus69: what's the benefit of freezing? just for protection against accidental mutation?
[11:40:07] havenwood: dionysus69: yup
[11:41:06] havenwood: wildermind: weird, seems like a Puppet error in monkey_patches.rb, line 178
[11:41:54] wildermind: havenwood: ok thanks, will try to install puppet without rvm lol, someone told me its the easiest
[11:42:23] havenwood: wildermind: doesn't look like an RVM problem
[11:42:42] wildermind: havenwood: you think its something with the package itself or my system
[11:43:04] havenwood: wildermind: i'm curious what's on that line?
[11:44:18] wildermind: I'll look now, where are the global ruby gems installed?
[11:44:41] havenwood: wildermind: check: gem env gemdir
[11:45:14] havenwood: wildermind: usually you don't want to do a global install of RVM - just a local one suffices and is less likely to result in permission issues
[11:46:29] wildermind: havenwood: found it
[11:46:35] wildermind: `mode = Fcntl::O_CREAT | Fcntl::O_WRONLY | (offset.nil? ? Fcntl::O_TRUNC : 0)`
[11:46:55] Swyper: has joined #ruby
[11:47:27] yokel: has joined #ruby
[11:49:40] havenwood: old, oh, they left - was gunna suggest: https://gist.github.com/havenwood/4d5f13feb50b4f46880eeb8c7ea1509e
[11:49:53] conta: has joined #ruby
[11:51:08] havenwood: wildermind: and what is `offset` defined as?
[11:52:05] havenwood: wildermind: i don't see a `<<` on that line?
[11:52:15] havenwood: "undefined method `<<' for nil:NilClass"
[11:54:05] yield_: has joined #ruby
[12:00:09] DTZUZO: has joined #ruby
[12:02:48] conta: has joined #ruby
[12:06:50] Swyper: has joined #ruby
[12:18:32] ryouba: "<<" is one of the Ruby things I miss the most in Matlab.
[12:21:13] AJA4350: has joined #ruby
[12:23:36] nadir: has joined #ruby
[12:34:33] AJA4351: has joined #ruby
[12:43:43] _joes_: has joined #ruby
[12:51:11] _whitelogger: has joined #ruby
[12:54:16] ldnunes: has joined #ruby
[12:54:49] suukim: has joined #ruby
[12:56:09] Swyper: has joined #ruby
[12:58:46] yield_: has joined #ruby
[12:59:29] yokel: has joined #ruby
[13:00:27] uplime: wouldn't it just be .append or += in most languages?
[13:03:29] dsmythe_: has joined #ruby
[13:07:40] gb_away: has joined #ruby
[13:08:34] AJA4351: has joined #ruby
[13:10:45] cthulchu: has joined #ruby
[13:15:59] jenrzzz: has joined #ruby
[13:16:05] adam12: dionysus69: Not sure if you're still working on this, but I took your gist and made a smaller gist with a few tests. I think I see the issue? but its too hard to really tell without seeing the method call invocation.
[13:16:33] adam12: dionysus69: What I think you're seeing is some_method(foo: true) is getting passed to method_missing as (args = [{foo: true}]), which you're then trying to splat.
[13:17:39] adam12: dionysus69: I added a keyword arg splat to method_missing and use a predicate to determine if we want to use args or kwargs. I'm sure there's a better way but I can't think of it right now. https://gist.github.com/adam12/a5fa8602357cd849ff39535bd137ee56
[13:20:16] nicb: has joined #ruby
[13:21:53] yield_: has joined #ruby
[13:22:11] RedSnarf: has joined #ruby
[13:25:00] Swyper: has joined #ruby
[13:28:28] Swyper: has joined #ruby
[13:28:29] cow[moo]: has joined #ruby
[13:31:47] mikker: Why does rubocop warn for useless assignent in this code: Net::HTTP::Post.new(uri, initheader = {"Content-Type" => "application/json"})
[13:32:12] ytti: because initheader is not used
[13:32:13] havenwood: _ikke_: do you subsequently use initheader
[13:32:27] ytti: Content-Type: "application/json"
[13:32:36] ytti: i guess that's not valid sym
[13:33:16] mikker: havenwood: no, initheader is a named argument in the initializer for Post
[13:33:34] ytti: no is not
[13:33:39] havenwood: _ikke_: it's not named though, it's positional
[13:33:45] ytti: it takes hash
[13:33:51] ytti: and the assingment returns said hash
[13:34:04] havenwood: _ikke_: Net::HTTP::Post.new(uri, {"Content-Type" => "application/json"})
[13:36:26] hightower2: has joined #ruby
[13:36:56] mikker: Ah ok, I thought it was not the 2nd parameter
[13:37:16] mikker: Was confused by the signature of HTTPGenericRequest.new
[13:38:10] mikker: I find the documentation kind of confusing
[13:41:42] shadeslayer: has joined #ruby
[13:42:16] adam12: _ikke_: Sometimes people use the assignment like that to indicate it's intent (ie, if you wanted to call it `headers` to remember what it does).
[13:42:29] AJA4351: has joined #ruby
[13:42:51] adam12: _ikke_: If you wanted to Rubocop from complaining, you could likely prefix the argument with an underscore. So _initheader = ...
[13:42:52] phaul: _ikke_: you should be looking at HTTPRequest not HTTPGenericRequest, as that's the direct parent
[13:43:11] phaul: and it's new signature is different
[13:43:40] phaul: &ri Net::HttpRequest.new
[13:43:41] rubydoc: Found no entry that matches class Net::HttpRequest class method new
[13:43:53] phaul: &ri Net::HTTPRequest.new
[13:43:54] rubydoc: https://ruby-doc.org/stdlib-2.6/libdoc/net/http/rdoc/Net/HTTPRequest.html#method-c-new
[13:45:25] mikker: phaul: thanks
[13:49:11] mikker: adam12: I don
[13:54:38] adam12: I wonder how long it will take before we see some RubyKaigi 2019 recordings on YT.
[14:00:51] Swyper: has joined #ruby
[14:02:23] AJA4350: has joined #ruby