In reference to
thread 117889 Wed,
27 Oct 2004,
does anyone know what's happened to this? This is about
openstruct picking up a defined method when the same name is passed to
openstruct send method. I ran into this problem with ruby 1.8.5 and I
found in the above thread that it was a known anomaly. It seems that
Matz intended to fix it. Still pending or I should use openstruct
differently?
In addition to that, although might be related, I don't
know, it seems that openstruct also picks up method from
module.
This one works as expected:
def foo
"foo"
end
OpenStruct.new.foo
=> nil
This one does not:
module Foo
def foo
"foo"
end
end
include Foo
OpenStruct.new.foo
=> foo
This is surely an anomaly too, is it not?
-andre
PS: I could have continued from that thread but I'm not
sure what the community preference here in regarding old, old
thread.
Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday cash from MSN today!