method
new
Ruby latest stable (v2_5_5)
-
0 notes -
Class: OpenStruct
new(hash=nil)
public
Creates a new OpenStruct object. By default, the resulting OpenStruct object will have no attributes.
The optional hash, if given, will generate attributes and values (can be a Hash, an OpenStruct or a Struct). For example:
require "ostruct" hash = { "country" => "Australia", :capital => "Canberra" } data = OpenStruct.new(hash) data # => #<OpenStruct country="Australia", capital="Canberra">