method
to_h
v2_2_9 -
Show latest stable
- Class:
OpenStruct
to_h()public
Converts the OpenStruct to a hash with keys representing each attribute (as symbols) and their corresponding values.
require "ostruct" data = OpenStruct.new("country" => "Australia", :capital => "Canberra") data.to_h # => {:country => "Australia", :capital => "Canberra" }