Class: ManageIQ::Floe::Workflow::ChoiceRule
- Inherits:
-
Object
- Object
- ManageIQ::Floe::Workflow::ChoiceRule
- Defined in:
- lib/manageiq/floe/workflow/choice_rule.rb,
lib/manageiq/floe/workflow/choice_rule/data.rb,
lib/manageiq/floe/workflow/choice_rule/boolean.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#next ⇒ Object
readonly
Returns the value of attribute next.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#variable ⇒ Object
readonly
Returns the value of attribute variable.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(payload) ⇒ ChoiceRule
constructor
A new instance of ChoiceRule.
- #true? ⇒ Boolean
Constructor Details
#initialize(payload) ⇒ ChoiceRule
Returns a new instance of ChoiceRule.
24 25 26 27 28 29 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 24 def initialize(payload) @payload = payload @next = payload["Next"] @variable = payload["Variable"] end |
Instance Attribute Details
#next ⇒ Object (readonly)
Returns the value of attribute next.
22 23 24 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 22 def next @next end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
22 23 24 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 22 def payload @payload end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
22 23 24 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 22 def variable @variable end |
Class Method Details
.build(payload) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 12 def build(payload) data_expression = (payload.keys & %w[And Not Or]).empty? if data_expression ManageIQ::Floe::Workflow::ChoiceRule::Data.new(payload) else ManageIQ::Floe::Workflow::ChoiceRule::Boolean.new(payload) end end |
.true?(payload, context, input) ⇒ Boolean
8 9 10 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 8 def true?(payload, context, input) build(payload).true?(context, input) end |
Instance Method Details
#true? ⇒ Boolean
31 32 33 |
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 31 def true?(*) raise NotImplementedError, "Must be implemented in a subclass" end |