to_h()
Instance Public methods
Converts the OpenStruct to a hash with keys representing each attribute (as symbols) and their corresponding values Example:
1 2 3 | require 'ostruct' data = OpenStruct. new ( "country" => "Australia" , :population => 20_000_000 ) data.to_h # => {:country => "Australia", :population => 20000000 } |
Please login to continue.