I have a OpenStruct hash like this:
#<OpenStruct object1={
"param1"=>"2",
"param2"=>"1"
},
object2={
"param1"=>"2",
"param2"=>"1"
},
object3={
"param1"=>"2",
"param2"=>"1"
}...
How can I use each on this?
OpenStruct has a method called marshal_dump that returns the underlying hash structure:
If you are using Ruby 2.0, you can use also to_h like so:
Unlike
marshal_dump, which returns the actual hash structure,to_hreturns a hash with all the keys converted to symbols for easier access.