Class: S3Batch::TaskManager
- Inherits:
-
Object
- Object
- S3Batch::TaskManager
- Defined in:
- lib/s3batch/batch_upload.rb
Instance Method Summary collapse
- #add ⇒ Object
- #end_adding ⇒ Object
-
#initialize ⇒ TaskManager
constructor
A new instance of TaskManager.
- #remove ⇒ Object
Constructor Details
#initialize ⇒ TaskManager
Returns a new instance of TaskManager.
4 5 6 7 |
# File 'lib/s3batch/batch_upload.rb', line 4 def initialize @count = 0 @adding_ended = false end |
Instance Method Details
#add ⇒ Object
9 10 11 |
# File 'lib/s3batch/batch_upload.rb', line 9 def add @count += 1 end |
#end_adding ⇒ Object
18 19 20 21 |
# File 'lib/s3batch/batch_upload.rb', line 18 def end_adding @adding_ended = true EM.stop if @count == 0 end |
#remove ⇒ Object
13 14 15 16 |
# File 'lib/s3batch/batch_upload.rb', line 13 def remove @count -= 1 EM.stop if @count == 0 && @adding_ended end |