Class: Hermod::InputMutator
- Inherits:
-
Object
- Object
- Hermod::InputMutator
- Defined in:
- lib/hermod/input_mutator.rb
Instance Attribute Summary collapse
-
#mutator_proc ⇒ Object
readonly
Returns the value of attribute mutator_proc.
Instance Method Summary collapse
-
#initialize(mutator_proc) ⇒ InputMutator
constructor
A new instance of InputMutator.
- #mutate!(values, attributes, instance) ⇒ Object
Constructor Details
#initialize(mutator_proc) ⇒ InputMutator
Returns a new instance of InputMutator.
5 6 7 |
# File 'lib/hermod/input_mutator.rb', line 5 def initialize(mutator_proc) @mutator_proc = mutator_proc end |
Instance Attribute Details
#mutator_proc ⇒ Object (readonly)
Returns the value of attribute mutator_proc.
3 4 5 |
# File 'lib/hermod/input_mutator.rb', line 3 def mutator_proc @mutator_proc end |
Instance Method Details
#mutate!(values, attributes, instance) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/hermod/input_mutator.rb', line 9 def mutate!(values, attributes, instance) if mutator_proc.arity == 2 mutator_proc.call(values, attributes) else mutator_proc.call(values, attributes, instance) end end |