Class: RSchema::Coercers::Any::Builder

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

Overview

Builder for Coercers::Any

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subbuilders) ⇒ Builder

Returns a new instance of Builder.


37
38
39
# File 'lib/rschema/coercers/any.rb', line 37

def initialize(subbuilders)
  @subbuilders = subbuilders
end

Instance Attribute Details

#subbuildersObject (readonly)

Returns the value of attribute subbuilders


35
36
37
# File 'lib/rschema/coercers/any.rb', line 35

def subbuilders
  @subbuilders
end

Instance Method Details

#build(schema) ⇒ Object


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

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