Class: Fabulator::Core::Actions::When

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

Instance Method Summary collapse

Instance Method Details

#run_test(context) ⇒ Object



30
31
32
33
34
35
# File 'lib/fabulator/core/actions/choose.rb', line 30

def run_test(context)
  return true if @test.nil?
  result = self.test(@context.merge(context)).collect{ |a| !!a.value }
  return false if result.nil? || result.empty? || !result.include?(true)
  return true
end