Class: Fabulator::Grammar::Actions::Result

Inherits:
Action
  • Object
show all
Defined in:
lib/fabulator/grammar/actions/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fabulator/grammar/actions/result.rb', line 5

def name
  @name
end

#selectObject

Returns the value of attribute select.



5
6
7
# File 'lib/fabulator/grammar/actions/result.rb', line 5

def select
  @select
end

Instance Method Details

#run(context, autovivify = false) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/fabulator/grammar/actions/result.rb', line 12

def run(context, autovivify = false)
  @context.with(context) do |ctx|
    values = self.has_actions? ? self.run_actions(ctx) : @select.run(ctx,false)
    if !values.nil?
      ctx.with_root(ctx.root.roots['result']).set_value(self.path, values)
    end
  end
end