Class: Low::Events::HiddenEvent
- Inherits:
-
Object
- Object
- Low::Events::HiddenEvent
- Includes:
- LowType
- Defined in:
- lib/events/hidden_event.rb
Overview
An event that happens on event tree branching and isn’t added to the event tree/sequence.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key:, action: nil) ⇒ HiddenEvent
constructor
A new instance of HiddenEvent.
- #trigger ⇒ Object
Constructor Details
#initialize(key:, action: nil) ⇒ HiddenEvent
Returns a new instance of HiddenEvent.
13 14 15 16 17 |
# File 'lib/events/hidden_event.rb', line 13 def initialize(key:, action: nil) @key = key @action = action @created_at = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
11 12 13 |
# File 'lib/events/hidden_event.rb', line 11 def action @action end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
11 12 13 |
# File 'lib/events/hidden_event.rb', line 11 def created_at @created_at end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
11 12 13 |
# File 'lib/events/hidden_event.rb', line 11 def key @key end |
Class Method Details
.inherited(child) ⇒ Object
30 31 32 |
# File 'lib/events/hidden_event.rb', line 30 def inherited(child) child.include LowType end |
.trigger(**kwargs) ⇒ Object
26 27 28 |
# File 'lib/events/hidden_event.rb', line 26 def trigger(**kwargs) new(**kwargs).trigger end |
Instance Method Details
#trigger ⇒ Object
19 20 21 22 23 |
# File 'lib/events/hidden_event.rb', line 19 def trigger event_tree = branch key = Observers::Keys[@key] key.trigger(event: self) { restore_level(event_tree:) } end |