Module: KeyDial::Coercion::Hashes
- Included in:
- Hash
- Defined in:
- lib/key_dial/coercion.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#to_struct(type_class = nil) ⇒ Object
Convert a Hash to a Struct.
Class Method Details
.included(base) ⇒ Object
13 14 15 |
# File 'lib/key_dial/coercion.rb', line 13 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#to_struct(type_class = nil) ⇒ Object
Convert a Hash to a Struct. 1, b: 2, c: 3 will become <Struct :a=1, :b=2, :c=3>
9 10 11 |
# File 'lib/key_dial/coercion.rb', line 9 def to_struct(type_class = nil) return Coercion::Structs.create(self, type_class) end |