Class: ActiveJob::Status::Progress
- Inherits:
-
Object
- Object
- ActiveJob::Status::Progress
- Defined in:
- lib/activejob-status/progress.rb
Instance Method Summary collapse
- #decrement(num = 1) ⇒ Object
- #finish ⇒ Object
- #increment(num = 1) ⇒ Object
-
#initialize(job) ⇒ Progress
constructor
A new instance of Progress.
- #progress=(num) ⇒ Object
- #total=(num) ⇒ Object
Constructor Details
#initialize(job) ⇒ Progress
Returns a new instance of Progress.
6 7 8 9 10 |
# File 'lib/activejob-status/progress.rb', line 6 def initialize(job) @job = job @total = 100 @progress = 0 end |
Instance Method Details
#decrement(num = 1) ⇒ Object
25 26 27 |
# File 'lib/activejob-status/progress.rb', line 25 def decrement(num = 1) update { @progress - num } end |
#finish ⇒ Object
29 30 31 |
# File 'lib/activejob-status/progress.rb', line 29 def finish update { @total } end |
#increment(num = 1) ⇒ Object
21 22 23 |
# File 'lib/activejob-status/progress.rb', line 21 def increment(num = 1) update { @progress + num } end |
#progress=(num) ⇒ Object
17 18 19 |
# File 'lib/activejob-status/progress.rb', line 17 def progress=(num) update { num } end |
#total=(num) ⇒ Object
12 13 14 15 |
# File 'lib/activejob-status/progress.rb', line 12 def total=(num) @total = num update end |