Class: Heroku::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/heroku/process.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Process

Returns a new instance of Process.



6
7
8
9
10
11
12
# File 'lib/heroku/process.rb', line 6

def initialize(options = {})
  @app = options[:app]
  @logger = options[:logger]
  @pid = options[:pid]
  @status = options[:status]
  raise Heroku::Commander::Errors::MissingPidError unless @pid
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



4
5
6
# File 'lib/heroku/process.rb', line 4

def app
  @app
end

#loggerObject

Returns the value of attribute logger.



4
5
6
# File 'lib/heroku/process.rb', line 4

def logger
  @logger
end

#pidObject

Returns the value of attribute pid.



4
5
6
# File 'lib/heroku/process.rb', line 4

def pid
  @pid
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/heroku/process.rb', line 4

def status
  @status
end

Instance Method Details

#refresh_status!Object



14
15
16
17
18
19
20
21
22
# File 'lib/heroku/process.rb', line 14

def refresh_status!
  refreshed = false
  Heroku::Commander.new({ :logger => logger, :app => app }).processes.each do |process|
    next unless ! refreshed && process.pid == pid
    @status = process.status
    refreshed = true
  end
  refreshed
end