Module: Dry::Initializer
- Extended by:
- DSL
- Defined in:
- lib/dry/initializer.rb,
lib/dry/initializer/dsl.rb,
lib/dry/initializer/mixin.rb,
lib/dry/initializer/config.rb,
lib/dry/initializer/struct.rb,
lib/dry/initializer/version.rb,
lib/dry/initializer/builders.rb,
lib/dry/initializer/undefined.rb,
lib/dry/initializer/definition.rb,
lib/dry/initializer/mixin/root.rb,
lib/dry/initializer/dispatchers.rb,
lib/dry/initializer/mixin/local.rb,
lib/dry/initializer/builders/reader.rb,
lib/dry/initializer/builders/attribute.rb,
lib/dry/initializer/builders/signature.rb,
lib/dry/initializer/builders/initializer.rb,
lib/dry/initializer/dispatchers/wrap_type.rb,
lib/dry/initializer/dispatchers/check_type.rb,
lib/dry/initializer/dispatchers/unwrap_type.rb,
lib/dry/initializer/dispatchers/prepare_ivar.rb,
lib/dry/initializer/dispatchers/prepare_reader.rb,
lib/dry/initializer/dispatchers/prepare_source.rb,
lib/dry/initializer/dispatchers/prepare_target.rb,
lib/dry/initializer/dispatchers/prepare_default.rb,
lib/dry/initializer/dispatchers/prepare_optional.rb,
lib/dry/initializer/dispatchers/build_nested_type.rb
Overview
DSL for declaring params and options of class initializers
Defined Under Namespace
Modules: Builders, DSL, Dispatchers, Mixin, UNDEFINED Classes: Config, Definition, Struct
Constant Summary collapse
- VERSION =
"3.1.1"
Instance Attribute Summary
Attributes included from DSL
Instance Method Summary collapse
-
#dry_initializer ⇒ Dry::Initializer::Config
Gem-related configuration.
-
#option(name, type = nil, **opts) { ... } ⇒ self
Adds or redefines an option of [#dry_initializer].
-
#param(name, type = nil, **opts) { ... } ⇒ self
Adds or redefines a parameter of [#dry_initializer].
Methods included from DSL
Instance Method Details
#dry_initializer ⇒ Dry::Initializer::Config
Gem-related configuration
24 25 26 |
# File 'lib/dry/initializer.rb', line 24 def dry_initializer @dry_initializer ||= Config.new(self) end |
#option(name, type = nil, **opts) { ... } ⇒ self
Adds or redefines an option of [#dry_initializer]
47 48 49 50 |
# File 'lib/dry/initializer.rb', line 47 def option(name, type = nil, **opts, &block) dry_initializer.option(name, type, **opts, &block) self end |
#param(name, type = nil, **opts) { ... } ⇒ self
Adds or redefines a parameter of [#dry_initializer]
37 38 39 40 |
# File 'lib/dry/initializer.rb', line 37 def param(name, type = nil, **opts, &block) dry_initializer.param(name, type, **opts, &block) self end |