Class: Derrick::Progress
- Inherits:
-
Object
- Object
- Derrick::Progress
- Defined in:
- lib/derrick/progress.rb
Instance Attribute Summary collapse
-
#collected ⇒ Object
readonly
Returns the value of attribute collected.
-
#fetched ⇒ Object
readonly
Returns the value of attribute fetched.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #increment_collected(count) ⇒ Object
- #increment_fetched(count) ⇒ Object
-
#initialize(total) ⇒ Progress
constructor
A new instance of Progress.
Constructor Details
#initialize(total) ⇒ Progress
Returns a new instance of Progress.
5 6 7 8 9 10 11 |
# File 'lib/derrick/progress.rb', line 5 def initialize(total) @total = total @mutex = Mutex.new @collected = 0 @fetched = 0 end |
Instance Attribute Details
#collected ⇒ Object (readonly)
Returns the value of attribute collected.
3 4 5 |
# File 'lib/derrick/progress.rb', line 3 def collected @collected end |
#fetched ⇒ Object (readonly)
Returns the value of attribute fetched.
3 4 5 |
# File 'lib/derrick/progress.rb', line 3 def fetched @fetched end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
3 4 5 |
# File 'lib/derrick/progress.rb', line 3 def total @total end |
Instance Method Details
#increment_collected(count) ⇒ Object
13 14 15 |
# File 'lib/derrick/progress.rb', line 13 def increment_collected(count) @mutex.synchronize { @collected += count } end |
#increment_fetched(count) ⇒ Object
17 18 19 |
# File 'lib/derrick/progress.rb', line 17 def increment_fetched(count) @mutex.synchronize { @fetched += count } end |