search for: openhash

Displaying 1 result from an estimated 1 matches for "openhash".

Did you mean: openhal
2007 Nov 28
0
OpenHash class I thought I would share...
I love OpenStruct, but it has no ability to iterate over the members. I had extended it, but recently I use this little class. Anyone see any issues with it ? class OpenHash < Hash def method_missing(name, value=nil) key = name.to_s.sub(/[=?!]$/,'''').to_sym self[key] = value if name.to_s[-1,1] == "=" return self[key] end end >> o = OpenHash.new => {} >> o.a = 1 => 1 >> o.b = 2 => 2 >> o.h...