class OpenStruct

def each_pair


data.each_pair.to_a # => [[:country, "Australia"], [:capital, "Canberra"]]
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
require "ostruct"

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

ostruct.each_pair -> Enumerator
ostruct.each_pair {|name, value| block } -> ostruct
:call-seq:
def each_pair
  return to_enum(__method__) { @table.size } unless defined?(yield)
  @table.each_pair{|p| yield p}
  self
end