method

each_pair

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

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]]
Show source
Register or log in to add new notes.