Class: Observed::MutableTask
- Inherits:
-
Object
- Object
- Observed::MutableTask
- Defined in:
- lib/observed/task.rb
Instance Method Summary collapse
-
#initialize(current_task) ⇒ MutableTask
constructor
A new instance of MutableTask.
- #now(data = {}, options = nil) ⇒ Object
- #then(*tasks) ⇒ Object
Constructor Details
#initialize(current_task) ⇒ MutableTask
Returns a new instance of MutableTask.
27 28 29 30 |
# File 'lib/observed/task.rb', line 27 def initialize(current_task) @current_task = current_task @mutex = Mutex.new end |
Instance Method Details
#now(data = {}, options = nil) ⇒ Object
31 32 33 34 35 |
# File 'lib/observed/task.rb', line 31 def now(data={}, =nil) @current_task.now(data, ) do |data, | yield data, ( || ) if block_given? end end |
#then(*tasks) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/observed/task.rb', line 36 def then(*tasks) @mutex.synchronize do @current_task = @current_task.then(*tasks) end self end |