Class: TypedParams::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/typed_params/processor.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema:, controller: nil) ⇒ Processor

Returns a new instance of Processor.



5
6
7
8
# File 'lib/typed_params/processor.rb', line 5

def initialize(schema:, controller: nil)
  @controller = controller
  @schema     = schema
end

Instance Method Details

#call(value) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/typed_params/processor.rb', line 10

def call(value)
  params   = Parameterizer.new(schema:).call(value:)
  pipeline = Pipeline.new

  pipeline << Bouncer.new(controller:, schema:)
  pipeline << Coercer.new(schema:)
  pipeline << Validator.new(schema:)
  pipeline << Transformer.new(controller:, schema:)

  pipeline.call(params)
end