method

each_pair

Importance_1
v2_2_9 - Show latest stable - 0 notes - Class: OpenStruct
each_pair() public

Yields all attributes (as symbols) along with the corresponding values or returns an enumerator if no block is given.

require "ostruct"
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.each_pair.to_a   # => [[:country, "Australia"], [:capital, "Canberra"]]
Show source
Register or log in to add new notes.