Class: Dry::Initializer::Struct
- Inherits:
-
Object
- Object
- Dry::Initializer::Struct
- Extended by:
- Dry::Initializer
- Defined in:
- lib/dry/initializer/struct.rb
Constant Summary
Constants included from Dry::Initializer
Instance Attribute Summary
Attributes included from DSL
Class Method Summary collapse
- .new(options) ⇒ Object (also: call)
Instance Method Summary collapse
-
#to_h ⇒ Hash<String, ...>
Represents event data as a nested hash with deeply stringified keys.
Methods included from Dry::Initializer
dry_initializer, option, param
Methods included from DSL
Class Method Details
.new(options) ⇒ Object Also known as: call
13 14 15 |
# File 'lib/dry/initializer/struct.rb', line 13 def new() super(**Hash().each_with_object({}) { |(k, v), h| h[k.to_sym] = v }) end |
Instance Method Details
#to_h ⇒ Hash<String, ...>
Represents event data as a nested hash with deeply stringified keys
23 24 25 26 27 28 29 |
# File 'lib/dry/initializer/struct.rb', line 23 def to_h self .class .dry_initializer .attributes(self) .each_with_object({}) { |(k, v), h| h[k.to_s] = __hashify(v) } end |