method

to_h

Importance_1
v2_1_10 - Show latest stable - 0 notes - 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 }
Show source
Register or log in to add new notes.