Class: Hatchet::UserEventCondition
- Inherits:
-
Object
- Object
- Hatchet::UserEventCondition
- Defined in:
- lib/hatchet/conditions.rb
Overview
A condition that waits for a user event with a specific key
Instance Attribute Summary collapse
-
#event_key ⇒ String
readonly
The event key to listen for.
-
#expression ⇒ String?
readonly
Optional CEL expression to filter events.
Instance Method Summary collapse
-
#initialize(event_key:, expression: nil) ⇒ UserEventCondition
constructor
A new instance of UserEventCondition.
- #to_h ⇒ Hash
Constructor Details
#initialize(event_key:, expression: nil) ⇒ UserEventCondition
Returns a new instance of UserEventCondition.
39 40 41 42 |
# File 'lib/hatchet/conditions.rb', line 39 def initialize(event_key:, expression: nil) @event_key = event_key @expression = expression end |
Instance Attribute Details
#event_key ⇒ String (readonly)
Returns The event key to listen for.
32 33 34 |
# File 'lib/hatchet/conditions.rb', line 32 def event_key @event_key end |
#expression ⇒ String? (readonly)
Returns Optional CEL expression to filter events.
35 36 37 |
# File 'lib/hatchet/conditions.rb', line 35 def expression @expression end |
Instance Method Details
#to_h ⇒ Hash
45 46 47 48 49 |
# File 'lib/hatchet/conditions.rb', line 45 def to_h h = { type: "user_event", event_key: @event_key } h[:expression] = @expression if @expression h end |