Class: HashToStruct::Struct
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- HashToStruct::Struct
- Defined in:
- lib/hash_to_struct/struct.rb
Instance Method Summary collapse
-
#initialize(hash, builder_class: HashToStruct::StructBuilder, immutable: false, including_arrays: false) ⇒ Struct
constructor
A new instance of Struct.
- #to_h ⇒ Object
Constructor Details
#initialize(hash, builder_class: HashToStruct::StructBuilder, immutable: false, including_arrays: false) ⇒ Struct
Returns a new instance of Struct.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hash_to_struct/struct.rb', line 5 def initialize( hash, builder_class: HashToStruct::StructBuilder, immutable: false, including_arrays: false ) @options = { builder_class: builder_class, immutable: immutable, including_arrays: including_arrays } __setobj__(to_struct(hash)) freeze if immutable end |
Instance Method Details
#to_h ⇒ Object
20 21 22 |
# File 'lib/hash_to_struct/struct.rb', line 20 def to_h to_hash end |