each_pair

each_pair() Instance Public methods Yields all attributes (as a symbol) along with the corresponding values or returns an enumerator if not block is given. Example: require 'ostruct' data = OpenStruct.new("country" => "Australia", :population => 20_000_000) data.each_pair.to_a # => [[:country, "Australia"], [:population, 20000000]]

eql?

eql?(other) Instance Public methods Compares this object and other for equality. An OpenStruct is eql? to other when other is an OpenStruct and the two objects' Hash tables are eql?.

hash

hash() Instance Public methods Compute a hash-code for this OpenStruct. Two hashes with the same content will have the same hash code (and will be eql?).

initialize_copy

initialize_copy(orig) Instance Public methods Duplicate an OpenStruct object members.

inspect

inspect() Instance Public methods Returns a string containing a detailed summary of the keys and values. to_s

marshal_dump

marshal_dump() Instance Public methods Provides marshalling support for use by the Marshal library.

marshal_load

marshal_load(x) Instance Public methods Provides marshalling support for use by the Marshal library.

to_h

to_h() Instance Public methods Converts the OpenStruct to a hash with keys representing each attribute (as symbols) and their corresponding values Example: require 'ostruct' data = OpenStruct.new("country" => "Australia", :population => 20_000_000) data.to_h # => {:country => "Australia", :population => 20000000 }

to_json

to_json(*args) Instance Public methods Stores class name (OpenStruct) with this struct's values v as a JSON string.

to_s

to_s() Instance Public methods Alias for: inspect