Class: RSchema::Coercers::Chain::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/rschema/coercers/chain.rb

Overview

Builder for Coercers::Chain

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subbuilders) ⇒ Builder

Returns a new instance of Builder.


38
39
40
# File 'lib/rschema/coercers/chain.rb', line 38

def initialize(subbuilders)
  @subbuilders = subbuilders
end

Instance Attribute Details

#subbuildersObject (readonly)

Returns the value of attribute subbuilders


36
37
38
# File 'lib/rschema/coercers/chain.rb', line 36

def subbuilders
  @subbuilders
end

Instance Method Details

#build(schema) ⇒ Object


42
43
44
45
46
47
# File 'lib/rschema/coercers/chain.rb', line 42

def build(schema)
  subcoercers = subbuilders.map do |builder|
    builder.build(schema)
  end
  Chain.new(subcoercers)
end