method

marshal_dump

v1_9_3_392 - Show latest stable - Class: OpenStruct
marshal_dump()
public

Provides marshalling support for use by the Marshal library. Returning the underlying Hash table that contains the functions defined as the keys and the values assigned to them.

require 'ostruct'

person = OpenStruct.new
person.name = 'John Smith'
person.age  = 70

person.marshal_dump # => { :name => 'John Smith', :age => 70 }