Actions
Bug #12291
closedStruct member accessor is not consistent with hash access when keys are repeated
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
Backport:
Description
irb(main):001:0> foo = Struct.new(:a, :a).new("1", "2")
=> #<struct a="1", a="2">
irb(main):002:0> foo.a
=> "2"
irb(main):003:0> foo['a']
=> "1"
irb(main):004:0> foo.members
=> [:a, :a]
irb(main):005:0> foo.to_h
=> {:a=>"2"}
Actions
Like0
Like0Like0Like0Like0Like0Like0