Class: Fabulator::Core::Actions::Variable

Inherits:
Action
  • Object
show all
Defined in:
lib/fabulator/core/actions/variables.rb

Instance Method Summary collapse

Instance Method Details

#run(context, autovivify = false) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/fabulator/core/actions/variables.rb', line 34

def run(context, autovivify = false)
  return [] if self.name.nil?
  res = [ ]
  @context.with(context) do |ctx|
    if !@select.nil?
      res = self.select(ctx)
    else
      res = self.run_actions(ctx)
    end
  end
  context.set_var(self.name, res)
  res
end