Class: Caster::Add
- Inherits:
-
Object
- Object
- Caster::Add
- Defined in:
- lib/caster/transform/add.rb
Instance Method Summary collapse
- #evaluate(obj, target_doc) ⇒ Object
- #execute(doc) ⇒ Object
-
#initialize(field, value) ⇒ Add
constructor
A new instance of Add.
Constructor Details
Instance Method Details
#evaluate(obj, target_doc) ⇒ Object
18 19 20 |
# File 'lib/caster/transform/add.rb', line 18 def evaluate obj, target_doc (obj.is_a? Reference)? obj.evaluate(target_doc) : obj end |
#execute(doc) ⇒ Object
13 14 15 16 |
# File 'lib/caster/transform/add.rb', line 13 def execute doc @accessor.set doc, @field, evaluate(@value, doc) doc end |