Class: ManageIQ::Floe::Workflow::ChoiceRule::Boolean

Inherits:
ManageIQ::Floe::Workflow::ChoiceRule show all
Defined in:
lib/manageiq/floe/workflow/choice_rule/boolean.rb

Instance Attribute Summary

Attributes inherited from ManageIQ::Floe::Workflow::ChoiceRule

#next, #payload, #variable

Instance Method Summary collapse

Methods inherited from ManageIQ::Floe::Workflow::ChoiceRule

build, #initialize, true?

Constructor Details

This class inherits a constructor from ManageIQ::Floe::Workflow::ChoiceRule

Instance Method Details

#true?(context, input) ⇒ Boolean

Returns:



8
9
10
11
12
13
14
15
16
# File 'lib/manageiq/floe/workflow/choice_rule/boolean.rb', line 8

def true?(context, input)
  if payload.key?("Not")
    !ChoiceRule.true?(payload["Not"], context, input)
  elsif payload.key?("And")
    payload["And"].all? { |choice| ChoiceRule.true?(choice, context, input) }
  else
    payload["Or"].any? { |choice| ChoiceRule.true?(choice, context, input) }
  end
end