class ProcessHandler

Attributes

clazz[R]
error[R]
id[R]
interrupted[R]
log[R]
name[R]
performed[R]
total[RW]
user_id[R]

Public Class Methods

new(id, name, clazz, user_id) click to toggle source
# File lib/sinatra/extensions/processmanager.rb, line 32
def initialize(id, name, clazz, user_id)
  @id = id
  @total = 0
  @performed = 0
  @log = []
  @error = ""
  @interrupted = false
  @name = name
  @clazz = clazz
  @user_id = user_id
end

Public Instance Methods

increase() click to toggle source
# File lib/sinatra/extensions/processmanager.rb, line 49
def increase
  @performed += 1
end
interrupt() click to toggle source
# File lib/sinatra/extensions/processmanager.rb, line 57
def interrupt
  @interrupted = true
end
interrupted?() click to toggle source
# File lib/sinatra/extensions/processmanager.rb, line 61
def interrupted?
  @interrupted
end
progress() click to toggle source
# File lib/sinatra/extensions/processmanager.rb, line 44
def progress
  return 0 if @total == 0
  (@performed.to_f / @total.to_f)*100.0
end
running?() click to toggle source
# File lib/sinatra/extensions/processmanager.rb, line 65
def running?
  @total != @performed
end