method
to_h
ruby 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" }