Re: Get OpenStruct attributes
[Note: parts of this message were removed to make it a legal post.]
Hi,
On Thu, Mar 13, 2008 at 7:04 AM, Trans <transfire@gmail.com> wrote:
> o = OpenStruct.new(:a=>1,:b=>2)
> => #<OpenStruct a=1, b=2>
> >> o.instance_variable_get("@table")
> => {:a=>1, :b=>2}
>
Looking into internals sounds dangerous. How about -
>> a = OpenStruct.new
=> #<OpenStruct>
>> a.field = "this"
=> "this"
>> a.old = "that"
=> "that"
>> a.methods false
=> ["field=", "old=", "field", "old"]
>>
Arlen
|