method

each_pair

Importance_1
Ruby latest stable (v2_5_5) - 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.