jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
TCZ has quit [Quit: ...]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
reset has quit [Quit: reset]
abws has joined #ruby
<abws> def test (**options);end; test({ :name => 'bob' }) gives ":1:in `test': wrong number of arguments (given 1, expected 0) (ArgumentError)". How comes ?
roadie has joined #ruby
<abws> it is with ruby 3.0.3 and git master
<abws> this was on armhf. On an x86_64 with ruby 2.7.4p191 all is fine
<adam12> abws: Ruby 3 changed keyword arg handling.
<abws> if I replace "test(options)" by "test(**{ :name => 'bob' })" with ruby3.0 the issue is fixed but in my real world case I cannot (a "super" call is interleaved and I do not see how to apply "**" to its argument
<abws> adam12: do you have a pointer ? I found that adding "**" to the argument helps for simple case but fot the chaining "method > super > method" I am at loss
<adam12> abws: Ruby < 3 would implicitly destructure a Hash into keyword arguments if it was the last parameter to a method call. Ruby 3 broke that. If you called with ruby -W it would probably warn for you on 2.7
<adam12> abws: test(name: "bob")
<adam12> or def test(options) if you always want a Hash.
<abws> adam12: but isn't it the opposite (test(keyword: value) is not supported but test({keyword: value}) is unchanged ?
<abws> I believe I do not understand the double splat operator
<adam12> abws: ** will capture keyword args in the method definition.
<abws> I though it flattened only when applied to the hash , not when before a parameter in a function definition
<adam12> It acts as a catch all for keyword arguments in the method definition.
<adam12> When called on a Hash it will call to_hash on it (ie. on the right side of an assignment).
<abws> adam12: I am still lost, even if I understand I misunderstood something. Do you have an example migration from double splat in parameter construct to ruby3.0 ?
gr33n7007h has quit [Ping timeout: 256 seconds]
<adam12> abws: No, but there's been some discussion about it on the web. How about this one? https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
<abws> indeed ruby2.7 -W tells about the deprecation
<adam12> Signing off for the night. Good luck.
<abws> thanks a lot
<abws> hum that is the document I already read but misunderstood. Well :-)
gr33n7007h has joined #ruby
<abws> ah got it but I am still stuck because I cannot apply the recommandation "# If you want to keep the behavior in Ruby 3.0, use double splat\n foo(**h) #=> 42"
<abws> ie "call(**hash) > super > def test(**parameter)" triggers the wrong number of argument at the "super" stage (because the double splat operator have to be set at each stage and on super I cannot ?)
<weaksauce> abws can you gist out a more complete example instead of in irc?
<weaksauce> too hard to follow the shortcuts
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
crankharder has joined #ruby
crankharder has quit [Ping timeout: 246 seconds]
roadie has quit [Ping timeout: 256 seconds]
<abws> l.14 I already added the double sprat operator to destructure the hash into keyword arguments (I understand this sentence now :-) but ruby choke on "super" l.29
<weaksauce> abws why not call it explicitly
<weaksauce> something like gitolite_config, repository, context, options = *args
<weaksauce> super gitolite_config, repository, context, **options
<abws> nice, a little more boilerplate but indeed smart
<weaksauce> yeah unfortunately it's not possible to avoid i guess since the calling conventions have changed
<weaksauce> i guess if you had to do a ton of them you could conceivably fix it with some kind of mixin or something but that opens up a new problem and a lot of tech debt
<weaksauce> the other option is to add **kwargs to the initialize method abws
<weaksauce> def initialize(*args, **kwargs)
<weaksauce> that'll allow you to call super directly
<weaksauce> and **{} is a smell
abws has quit [Ping timeout: 256 seconds]
abws has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
<abws> weaksauce: thank you !
<weaksauce> no problem
Rounin has quit [Ping timeout: 240 seconds]
emcb548 has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
emcb54 has quit [Ping timeout: 260 seconds]
emcb54 has joined #ruby
emcb548 has quit [Ping timeout: 256 seconds]
crankharder has joined #ruby
Sheilong has quit []
crankharder has quit [Ping timeout: 240 seconds]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
crankharder has joined #ruby
nirvdrum has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mixfix41 has quit [Quit: signing off cya]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
nirvdrum has joined #ruby
nirvdrum has quit [Ping timeout: 256 seconds]
crankharder has joined #ruby
oxfuxxx has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
oxfuxxx has quit [Ping timeout: 256 seconds]
oxfuxxx has joined #ruby
nirvdrum has joined #ruby
oxfuxxx has quit [Ping timeout: 240 seconds]
libsys has quit [Ping timeout: 256 seconds]
libsys has joined #ruby
dionysus69 has joined #ruby
nirvdrum has quit [Ping timeout: 246 seconds]
q3lont has joined #ruby
Tempesta has joined #ruby
oxfuxxx has joined #ruby
___nick___ has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
_ht has joined #ruby
Rounin has joined #ruby
justache has quit [Read error: Connection reset by peer]
justache has joined #ruby
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b3 - https://znc.in]
ollysmith has joined #ruby
il has joined #ruby
jpn has joined #ruby
roadie has joined #ruby
crankharder has joined #ruby
crankharder has quit [Ping timeout: 250 seconds]
reset has joined #ruby
hololeap has quit [Ping timeout: 240 seconds]
hololeap has joined #ruby
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
jpn has joined #ruby
hololeap has quit [Remote host closed the connection]
jpn has quit [Ping timeout: 246 seconds]
hololeap has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
darkstardevx has quit [Ping timeout: 248 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
moldorcoder7_ has quit [Ping timeout: 248 seconds]
moldorcoder7 has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
moldorcoder7_ has joined #ruby
moldorcoder7 has quit [Ping timeout: 256 seconds]
teclator has joined #ruby
moldorcoder7_ has quit [Read error: Connection reset by peer]
moldorcoder7 has joined #ruby
crankharder has joined #ruby
aeris has quit [Quit: ZNC - http://znc.sourceforge.net]
aeris has joined #ruby
crankharder has quit [Ping timeout: 256 seconds]
Liothen has quit [Ping timeout: 248 seconds]
hololeap has quit [Read error: Connection reset by peer]
conjunctive has quit [Ping timeout: 245 seconds]
JayDoubleu_ has quit [Ping timeout: 240 seconds]
conjunctive has joined #ruby
cyj123 has quit [Ping timeout: 250 seconds]
hololeap has joined #ruby
JayDoubleu_ has joined #ruby
Liothen has joined #ruby
cyj123 has joined #ruby
jpn has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
jpn has quit [Ping timeout: 256 seconds]
Pixi has quit [Read error: Connection reset by peer]
gr33n7007h has quit [Quit: WeeChat 3.5]
gr33n7007h has joined #ruby
roadie has joined #ruby
abws has quit [Ping timeout: 256 seconds]
crankharder has joined #ruby
jpn has joined #ruby
crankharder has quit [Ping timeout: 248 seconds]
jpn has quit [Ping timeout: 250 seconds]
TCZ has joined #ruby
moldorcoder7 has quit [Read error: Connection reset by peer]
Pixi has joined #ruby
moldorcoder7 has joined #ruby
comet23 has joined #ruby
<comet23> why does the if statement execute? https://bpa.st/7K7Q
jpn has joined #ruby
<TCZ> hm?
<TCZ> Lengths are the same so it executes else
jpn has quit [Ping timeout: 246 seconds]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
comet2394 has joined #ruby
TCZ has quit [Quit: ...]
abws has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
ssh073 has quit [Remote host closed the connection]
ssh073 has joined #ruby
xlymian has joined #ruby
nirvdrum has joined #ruby
hololeap has quit [Ping timeout: 240 seconds]
xlymian has quit [Client Quit]
hololeap has joined #ruby
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xlymian has joined #ruby
comet2394 has quit [Quit: Client closed]
xlymian has quit [Ping timeout: 256 seconds]
nirvdrum has joined #ruby
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reset has quit [Quit: reset]
comet23 has quit [Ping timeout: 250 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
justache has quit [Remote host closed the connection]
CrazyEddy has quit [Ping timeout: 240 seconds]
justache has joined #ruby
protektwar has quit [Remote host closed the connection]
justache has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
ur5us has joined #ruby
justache has joined #ruby
justache has left #ruby [#ruby]
q3lont has quit [Remote host closed the connection]
q3lont has joined #ruby
q3lont has quit [Ping timeout: 240 seconds]
comet23 has joined #ruby
<comet23> hi everyone :)
xlymian has joined #ruby
___nick___ has quit [Ping timeout: 246 seconds]
jpn has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
comet2391 has joined #ruby
comet23 has quit [Killed (NickServ (GHOST command used by comet2391))]
comet2391 is now known as comet23
xlymian has quit [Read error: Connection reset by peer]
<leah2> just use def random_word
<leah2> also self. is not needed to call in line 5
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX.]
nirvdrum has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
xlymian has joined #ruby
hololeap has quit [Ping timeout: 240 seconds]
CrazyEddy has joined #ruby
hololeap has joined #ruby
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jpn has joined #ruby
nirvdrum has joined #ruby
crankharder has joined #ruby
nirvdrum has quit [Client Quit]
roadie has joined #ruby
hololeap has quit [Ping timeout: 240 seconds]
crankharder has quit [Ping timeout: 246 seconds]
nirvdrum has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
nirvdrum has quit [Client Quit]
_ht has quit [Remote host closed the connection]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
jpn has quit [Ping timeout: 246 seconds]
nirvdrum has joined #ruby
nirvdrum has quit [Client Quit]
nirvdrum has joined #ruby
nirvdrum has quit [Client Quit]
roadie has joined #ruby
crankharder has joined #ruby
nirvdrum has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
crankharder has quit [Ping timeout: 248 seconds]
crankharder has joined #ruby
jpn has joined #ruby
<comet23> how would i initialize a new hash where keys are the room names from the hash arg and values are ClassName instances with the specified capacities
crankharder has quit [Ping timeout: 246 seconds]
<leftylink> actually I think Enumerable#to_h, with a block, would be useful here
<leftylink> Enumerable just has to much bang for the buck in terms of what it can do
<leftylink> a high-value thing to be thinking about
<weaksauce> yeah one of the best parts of ruby is the rich enumerable lib
jpn has quit [Ping timeout: 256 seconds]
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
roadie has joined #ruby
mixfix41 has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 250 seconds]
jpn has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
jpn has quit [Ping timeout: 248 seconds]
comet23 has quit [Quit: Client closed]
<ox1eef> quite sad to see how yard treats "extend", it makes practically no distinction with "include", so reading the docs one gets the idea the methods are included, rather than extended.
xlymian has quit [Ping timeout: 246 seconds]
<weaksauce> ox1eef have an example doc of that?
<ox1eef> https://0x1eef.github.io/x/ryo.rb/Ryo.html - scroll to, "Methods included by Reflect", "Methods included by Keywords" - and where the methods appear, under "instance methods"
<ox1eef> they're not included but extended, and not instance methods but singleton methods on Ryo
<weaksauce> ah
jpn has joined #ruby
<weaksauce> they do have extensions made for yard i wonder if there's one for it
<ox1eef> maybe that can be improved with a template tweak alone.
<weaksauce> perhaps
<ox1eef> it's weird because on classes ive defined singleton methods, there is a class method summary and it looks correct.
<ox1eef> Ryo is a module, not a class, maybe that's where the fault is
jpn has quit [Ping timeout: 250 seconds]
ur5us has quit [Ping timeout: 250 seconds]
jpn has joined #ruby
szkl has joined #ruby
jpn has quit [Ping timeout: 248 seconds]