Class: LittleGhost::Runtime::Hooks::Artifacts::InterjectionContext
- Inherits:
-
Data
- Object
- Data
- LittleGhost::Runtime::Hooks::Artifacts::InterjectionContext
- Defined in:
- lib/little_ghost/runtime/hooks/artifacts.rb
Instance Attribute Summary collapse
-
#cancellation_token ⇒ Object
readonly
Returns the value of attribute cancellation_token.
-
#deadline ⇒ Object
readonly
Returns the value of attribute deadline.
-
#run_context ⇒ Object
readonly
Returns the value of attribute run_context.
Instance Method Summary collapse
Instance Attribute Details
#cancellation_token ⇒ Object (readonly)
Returns the value of attribute cancellation_token
17 18 19 |
# File 'lib/little_ghost/runtime/hooks/artifacts.rb', line 17 def cancellation_token @cancellation_token end |
#deadline ⇒ Object (readonly)
Returns the value of attribute deadline
17 18 19 |
# File 'lib/little_ghost/runtime/hooks/artifacts.rb', line 17 def deadline @deadline end |
#run_context ⇒ Object (readonly)
Returns the value of attribute run_context
17 18 19 |
# File 'lib/little_ghost/runtime/hooks/artifacts.rb', line 17 def run_context @run_context end |
Instance Method Details
#artifact_control_values ⇒ Object
24 25 26 27 28 29 |
# File 'lib/little_ghost/runtime/hooks/artifacts.rb', line 24 def artifact_control_values { cancellation_tokens: [run_context.cancellation_token, cancellation_token].compact, deadlines: [run_context.deadline, deadline].compact } end |
#check! ⇒ Object
18 19 20 21 22 |
# File 'lib/little_ghost/runtime/hooks/artifacts.rb', line 18 def check! run_context.check! cancellation_token&.raise_if_cancelled! raise DeadlineExceededError, "The run deadline was reached" if deadline && Time.now >= deadline end |