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

Inherits:
Object
  • Object
show all
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

Direct Known Subclasses

Boolean, Data

Defined Under Namespace

Classes: Boolean, Data

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#nextObject (readonly)

Returns the value of attribute next.



22
23
24
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 22

def next
  @next
end

#payloadObject (readonly)

Returns the value of attribute payload.



22
23
24
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 22

def payload
  @payload
end

#variableObject (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

Returns:



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

Returns:

Raises:

  • (NotImplementedError)


31
32
33
# File 'lib/manageiq/floe/workflow/choice_rule.rb', line 31

def true?(*)
  raise NotImplementedError, "Must be implemented in a subclass"
end