Class: ActiveJob::Status::Progress

Inherits:
Object
  • Object
show all
Defined in:
lib/activejob-status/progress.rb

Instance Method Summary collapse

Constructor Details

#initialize(job) ⇒ Progress

Returns a new instance of Progress.



5
6
7
8
9
# File 'lib/activejob-status/progress.rb', line 5

def initialize(job)
  @job      = job
  @total    = 100
  @progress = 0
end

Instance Method Details

#decrement(num = 1) ⇒ Object



24
25
26
# File 'lib/activejob-status/progress.rb', line 24

def decrement(num=1)
  update { @progress - num }
end

#finishObject



28
29
30
# File 'lib/activejob-status/progress.rb', line 28

def finish
  update { @total }
end

#increment(num = 1) ⇒ Object



20
21
22
# File 'lib/activejob-status/progress.rb', line 20

def increment(num=1)
  update { @progress + num }
end

#progress=(num) ⇒ Object



16
17
18
# File 'lib/activejob-status/progress.rb', line 16

def progress=(num)
  update { num }
end

#total=(num) ⇒ Object



11
12
13
14
# File 'lib/activejob-status/progress.rb', line 11

def total=(num)
  @total = num
  update
end