class OpenStruct
def initialize(hash=nil)
data # => #
data = OpenStruct.new(hash)
hash = { "country" => "Australia", :capital => "Canberra" }
require "ostruct"
For example:
(can be a Hash, an OpenStruct or a Struct).
The optional +hash+, if given, will generate attributes and values
object will have no attributes.
Creates a new OpenStruct object. By default, the resulting OpenStruct
def initialize(hash=nil) if hash update_to_values!(hash) else @table = {} end end