module Dry::Initializer
DSL
for declaring params and options of class initializers
Constants
- VERSION
Public Instance Methods
dry_initializer()
click to toggle source
Gem-related configuration @return [Dry::Initializer::Config]
# File lib/dry/initializer.rb, line 24 def dry_initializer @dry_initializer ||= Config.new(self) end
option(name, type = nil, **opts, &block)
click to toggle source
param(name, type = nil, **opts, &block)
click to toggle source
Adds or redefines a parameter of [#dry_initializer] @param [Symbol] name @param [#call, nil] type (nil) @option opts [Proc] :default @option opts [Boolean] :optional @option opts [Symbol] :as @option opts [true, false, :protected, :public, :private] :reader @yield block with nested definition @return [self] itself
# File lib/dry/initializer.rb, line 37 def param(name, type = nil, **opts, &block) dry_initializer.param(name, type, **opts, &block) self end
Private Instance Methods
inherited(klass)
click to toggle source
Calls superclass method
# File lib/dry/initializer.rb, line 54 def inherited(klass) super config = Config.new(klass, null: dry_initializer.null) klass.send(:instance_variable_set, :@dry_initializer, config) dry_initializer.children << config end