Class: Caster::Create
- Inherits:
-
Object
- Object
- Caster::Create
- Defined in:
- lib/caster/transform/create.rb
Instance Method Summary collapse
- #execute(doc) ⇒ Object
-
#initialize(params) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(params) ⇒ Create
Returns a new instance of Create.
4 5 6 |
# File 'lib/caster/transform/create.rb', line 4 def initialize params @params_template = params end |
Instance Method Details
#execute(doc) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/caster/transform/create.rb', line 8 def execute doc params = @params_template.clone params.each do |field, value| if value.is_a? Reference params[field] = value.evaluate doc end end params end |