method
to_h
v2_1_10 -
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 Example:
require 'ostruct' data = OpenStruct.new("country" => "Australia", :population => 20_000_000) data.to_h # => {:country => "Australia", :population => 20000000 }