Class: Reaction::ParamBuilder
- Inherits:
-
Object
- Object
- Reaction::ParamBuilder
- Defined in:
- lib/reaction/param_builder.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#type_builder ⇒ Object
Returns the value of attribute type_builder.
-
#validator_builders ⇒ Object
Returns the value of attribute validator_builders.
Instance Method Summary collapse
- #build(action, raw_value, provided = true) ⇒ Object
-
#initialize(name, type_builder = nil, validator_builders = []) ⇒ ParamBuilder
constructor
A new instance of ParamBuilder.
Constructor Details
#initialize(name, type_builder = nil, validator_builders = []) ⇒ ParamBuilder
Returns a new instance of ParamBuilder.
7 8 9 10 11 |
# File 'lib/reaction/param_builder.rb', line 7 def initialize(name, type_builder = nil, validator_builders = []) @name = name @type_builder = type_builder @validator_builders = validator_builders end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/reaction/param_builder.rb', line 3 def name @name end |
#type_builder ⇒ Object
Returns the value of attribute type_builder.
4 5 6 |
# File 'lib/reaction/param_builder.rb', line 4 def type_builder @type_builder end |
#validator_builders ⇒ Object
Returns the value of attribute validator_builders.
5 6 7 |
# File 'lib/reaction/param_builder.rb', line 5 def validator_builders @validator_builders end |
Instance Method Details
#build(action, raw_value, provided = true) ⇒ Object
13 14 15 16 17 |
# File 'lib/reaction/param_builder.rb', line 13 def build(action, raw_value, provided = true) type = type_builder.build(action) validators = validator_builders.map{ |vb| vb.build(action) } Param.new(action, type, validators, name, raw_value, provided) end |