Class: Falkor::Progress
- Inherits:
-
Object
- Object
- Falkor::Progress
- Defined in:
- lib/falkor/progress.rb
Instance Method Summary collapse
- #increment!(amount, description) {|percentage(current), description| ... } ⇒ 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 |
# File 'lib/falkor/progress.rb', line 5 def initialize(total) @total = total @current = 0 @previous = 0 end |
Instance Method Details
#increment!(amount, description) {|percentage(current), description| ... } ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/falkor/progress.rb', line 11 def increment!(amount, description) self.previous, self.current = current, current + amount return if percentage(previous) == percentage(current) && !description yield percentage(current), description end |