module Dry::Initializer::Dispatchers

Attributes

null[RW]

@!attribute [rw] null Defines a value to be set to unassigned attributes @return [Object]

Public Instance Methods

<<(dispatcher) click to toggle source

Registers a new dispatcher

@param [#call] dispatcher @return [self] itself

# File lib/dry/initializer/dispatchers.rb, line 79
def <<(dispatcher)
  @pipeline = [dispatcher] + pipeline
  self
end
call(**options) click to toggle source

Normalizes the source set of options

@param [Hash<Symbol, Object>] options @return [Hash<Symbol, Objct>] normalized set of options

# File lib/dry/initializer/dispatchers.rb, line 90
def call(**options)
  options = {null: null, **options}
  pipeline.reduce(options) { |opts, dispatcher| dispatcher.call(**opts) }
end

Private Instance Methods

pipeline() click to toggle source
# File lib/dry/initializer/dispatchers.rb, line 108
def pipeline
  @pipeline ||= [
    PrepareSource, PrepareTarget, PrepareIvar, PrepareReader,
    PrepareDefault, PrepareOptional,
    UnwrapType, CheckType, BuildNestedType, WrapType
  ]
end