Class: Hatchet::ParentCondition
- Inherits:
-
Object
- Object
- Hatchet::ParentCondition
- Defined in:
- lib/hatchet/conditions.rb
Overview
A condition based on parent task output
Instance Attribute Summary collapse
-
#expression ⇒ String
readonly
CEL expression evaluated against the parent’s output.
-
#parent ⇒ Hatchet::Task, ...
readonly
Reference to the parent task.
Instance Method Summary collapse
-
#initialize(parent:, expression:) ⇒ ParentCondition
constructor
A new instance of ParentCondition.
- #to_h ⇒ Hash
Constructor Details
#initialize(parent:, expression:) ⇒ ParentCondition
Returns a new instance of ParentCondition.
65 66 67 68 |
# File 'lib/hatchet/conditions.rb', line 65 def initialize(parent:, expression:) @parent = parent @expression = expression end |
Instance Attribute Details
#expression ⇒ String (readonly)
Returns CEL expression evaluated against the parent’s output.
61 62 63 |
# File 'lib/hatchet/conditions.rb', line 61 def expression @expression end |
#parent ⇒ Hatchet::Task, ... (readonly)
Returns Reference to the parent task.
58 59 60 |
# File 'lib/hatchet/conditions.rb', line 58 def parent @parent end |
Instance Method Details
#to_h ⇒ Hash
71 72 73 74 75 76 77 78 |
# File 'lib/hatchet/conditions.rb', line 71 def to_h parent_name = case @parent when Symbol then @parent.to_s when String then @parent else @parent.respond_to?(:name) ? @parent.name.to_s : @parent.to_s end { type: "parent_condition", parent: parent_name, expression: @expression } end |