Class: Chamomile::CancelToken
- Inherits:
-
Object
- Object
- Chamomile::CancelToken
- Defined in:
- lib/chamomile/commands.rb
Overview
A cancel token for cancellable commands.
Instance Method Summary collapse
- #cancel! ⇒ Object
- #cancelled? ⇒ Boolean
-
#initialize ⇒ CancelToken
constructor
A new instance of CancelToken.
Constructor Details
#initialize ⇒ CancelToken
Returns a new instance of CancelToken.
54 55 56 |
# File 'lib/chamomile/commands.rb', line 54 def initialize @cancelled = Concurrent::AtomicBoolean.new(false) end |
Instance Method Details
#cancel! ⇒ Object
58 59 60 |
# File 'lib/chamomile/commands.rb', line 58 def cancel! @cancelled.make_true end |
#cancelled? ⇒ Boolean
62 63 64 |
# File 'lib/chamomile/commands.rb', line 62 def cancelled? @cancelled.true? end |