After creating a new Ruby OpenStruct object, I am able to store attributes but not to retrieve them (I get a blank line and it returns nil
instead):
obj = OpenStruct.new # => #<OpenStruct>
obj.x = 10
obj.y = 20
obj # => #<OpenStruct x=10, y=20>
obj.x # => 10
obj.y #
# => nil
If I try to store other properties with different names, everything works as expected. This problem seems to happen only when I store a property named y
. I'm using the following version:
ruby 1.9.2p320 (2012-04-20 revision 35421) [i686-linux]
Does anybody have an idea of what's going on?