Class: Fabulator::Core::Actions::If
- Inherits:
-
Action
- Object
- Action
- Fabulator::Core::Actions::If
- Defined in:
- lib/fabulator/core/actions/choose.rb
Instance Method Summary collapse
Instance Method Details
#run(context, autovivify = false) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/fabulator/core/actions/choose.rb', line 44 def run(context, autovivify = false) return [ ] if @test.nil? @context.with(context) do |ctx| test_res = self.test(ctx).collect{ |a| !!a.value } return [ ] if test_res.nil? || test_res.empty? || !test_res.include?(true) return self.run_actions(ctx) end end |