Returns the key values as a hash of the assigned struct.
person = OpenStruct.new(name: 'bob', age: 60)
person.attributes #=> { name: 'bob', age: 60 }
Replaces values provided within the hash.
person = OpenStruct.new(name: 'bob', age: 60)
person.replace(name: 'tom', age: 28)
preson.name #=> 'tom'
Returns the key values as a hash of the assigned struct.
person = OpenStruct.new(name: 'bob', age: 60)
person.to_hash #=> { table: { name: 'bob', age: 60 } }
person.to_hash(table: false) #=> { name: 'bob', age: 60 }
Returns the key values as Json of the assigned struct.
person = OpenStruct.new(name: 'bob', age: 60)
person.to_json #=> { table: { name: 'bob', age: 60 } }
person.to_json(table: false) #=> { name: 'bob', age: 60 }