Class: Serverspec::Type::Process
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::Process
show all
- Defined in:
- lib/serverspec/type/process.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #to_ary, #to_s
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth) ⇒ Object
18
19
20
|
# File 'lib/serverspec/type/process.rb', line 18
def method_missing(meth)
get_column(meth.to_s)
end
|
Instance Method Details
#get_column(keyword) ⇒ Object
22
23
24
25
26
27
|
# File 'lib/serverspec/type/process.rb', line 22
def get_column(keyword)
ret = backend.run_command(commands.get_process(@name, :format => "#{keyword}="))
val = ret.stdout.strip
val = val.to_i if val.match(/^\d+$/)
val
end
|
#group ⇒ Object
14
15
16
|
# File 'lib/serverspec/type/process.rb', line 14
def group
get_column("group")
end
|
#running? ⇒ Boolean
5
6
7
8
|
# File 'lib/serverspec/type/process.rb', line 5
def running?
pid = backend.run_command(commands.get_process(@name, :format => "pid=")).stdout
not pid.empty?
end
|
#user ⇒ Object
10
11
12
|
# File 'lib/serverspec/type/process.rb', line 10
def user
get_column("user")
end
|