Project

General

Profile

« Previous | Next » 

Revision 4c7f789e

Added by alanwu (Alan Wu) over 4 years ago

Allow only one argument for keyword_init struct

irb(main):001:0> RUBY_VERSION
=> "2.6.5"
irb(main):002:0> S = Struct.new(:foo, keyword_init: true)
=> S(keyword_init: true)
irb(main):003:0> S.new({foo: 23424}, 234) # I don't think this is intentional
=> #<struct S foo=23424>
irb(main):004:0>

Tightening this up should inform users when they are confused about
whether a struct is keyword_init.