Class: Caster::Rename
- Inherits:
-
Object
- Object
- Caster::Rename
- Defined in:
- lib/caster/transform/rename.rb
Instance Method Summary collapse
- #execute(doc) ⇒ Object
-
#initialize(old_name, new_name) ⇒ Rename
constructor
A new instance of Rename.
Constructor Details
Instance Method Details
#execute(doc) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/caster/transform/rename.rb', line 12 def execute doc doc[@new_name] = doc[@old_name] @accessor.set(doc, @new_name, @accessor.get(doc, @old_name)) @accessor.delete doc, @old_name doc end |