Class: Phantom::Process
- Inherits:
-
Object
- Object
- Phantom::Process
- Defined in:
- lib/phantom/process.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#memory_usage ⇒ Object
Returns the value of attribute memory_usage.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pid = nil, memory_usage = nil, command = nil, port = nil) ⇒ Process
constructor
A new instance of Process.
- #inspect ⇒ Object
- #kill ⇒ Object
- #start ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(pid = nil, memory_usage = nil, command = nil, port = nil) ⇒ Process
Returns a new instance of Process.
30 31 32 33 34 35 |
# File 'lib/phantom/process.rb', line 30 def initialize(pid = nil, memory_usage = nil, command = nil, port = nil) @pid = pid @memory_usage = memory_usage @command = command @port = port end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
7 8 9 |
# File 'lib/phantom/process.rb', line 7 def command @command end |
#memory_usage ⇒ Object
Returns the value of attribute memory_usage.
7 8 9 |
# File 'lib/phantom/process.rb', line 7 def memory_usage @memory_usage end |
#pid ⇒ Object
Returns the value of attribute pid.
7 8 9 |
# File 'lib/phantom/process.rb', line 7 def pid @pid end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/phantom/process.rb', line 7 def port @port end |
Class Method Details
.from_string(str) ⇒ Object
11 12 13 14 |
# File 'lib/phantom/process.rb', line 11 def from_string(str) args = parse_string(str) new(*args) end |
Instance Method Details
#inspect ⇒ Object
51 52 53 |
# File 'lib/phantom/process.rb', line 51 def inspect "pid: #{pid}, port: #{port}, memory_usage: #{memory_usage}, command: #{command}" end |
#kill ⇒ Object
37 38 39 40 |
# File 'lib/phantom/process.rb', line 37 def kill $logger.info "killing #{self}" Utils::Shell.execute "kill #{pid}" end |
#start ⇒ Object
42 43 44 45 |
# File 'lib/phantom/process.rb', line 42 def start $logger.info "starting phantomjs on port #{port}" Utils::Shell.execute start_command end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/phantom/process.rb', line 47 def to_s inspect end |