Class: ProcessHandler
- Inherits:
- 
      Object
      
        - Object
- ProcessHandler
 
- Defined in:
- lib/sinatra/extensions/processmanager.rb
Instance Attribute Summary collapse
- 
  
    
      #clazz  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute clazz. 
- 
  
    
      #error  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute error. 
- 
  
    
      #id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute id. 
- 
  
    
      #interrupted  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute interrupted. 
- 
  
    
      #log(severity, message)  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute log. 
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute name. 
- 
  
    
      #performed  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute performed. 
- 
  
    
      #total  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute total. 
- 
  
    
      #user_id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute user_id. 
Instance Method Summary collapse
- #increase ⇒ Object
- 
  
    
      #initialize(id, name, clazz, user_id)  ⇒ ProcessHandler 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ProcessHandler. 
- #interrupt ⇒ Object
- #interrupted? ⇒ Boolean
- #progress ⇒ Object
- #running? ⇒ Boolean
Constructor Details
#initialize(id, name, clazz, user_id) ⇒ ProcessHandler
Returns a new instance of ProcessHandler.
| 32 33 34 35 36 37 38 39 40 41 42 | # 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 | 
Instance Attribute Details
#clazz ⇒ Object (readonly)
Returns the value of attribute clazz.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def clazz @clazz end | 
#error ⇒ Object (readonly)
Returns the value of attribute error.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def error @error end | 
#id ⇒ Object (readonly)
Returns the value of attribute id.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def id @id end | 
#interrupted ⇒ Object (readonly)
Returns the value of attribute interrupted.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def interrupted @interrupted end | 
#log(severity, message) ⇒ Object (readonly)
Returns the value of attribute log.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def log @log end | 
#name ⇒ Object (readonly)
Returns the value of attribute name.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def name @name end | 
#performed ⇒ Object (readonly)
Returns the value of attribute performed.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def performed @performed end | 
#total ⇒ Object
Returns the value of attribute total.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def total @total end | 
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
| 29 30 31 | # File 'lib/sinatra/extensions/processmanager.rb', line 29 def user_id @user_id end | 
Instance Method Details
#increase ⇒ Object
| 49 50 51 | # File 'lib/sinatra/extensions/processmanager.rb', line 49 def increase @performed += 1 end | 
#interrupt ⇒ Object
| 57 58 59 | # File 'lib/sinatra/extensions/processmanager.rb', line 57 def interrupt @interrupted = true end | 
#interrupted? ⇒ Boolean
| 61 62 63 | # File 'lib/sinatra/extensions/processmanager.rb', line 61 def interrupted? @interrupted end | 
#progress ⇒ Object
| 44 45 46 47 | # 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? ⇒ Boolean
| 65 66 67 | # File 'lib/sinatra/extensions/processmanager.rb', line 65 def running? @total != @performed end |