Class: Inspec::Resources::Processes
- Inherits:
-
Object
- Object
- Inspec::Resources::Processes
- Defined in:
- lib/resources/processes.rb
Defined Under Namespace
Classes: Process
Instance Method Summary collapse
-
#initialize(grep) ⇒ Processes
constructor
A new instance of Processes.
- #list ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(grep) ⇒ Processes
Returns a new instance of Processes.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/resources/processes.rb', line 24 def initialize(grep) @grep = grep # turn into a regexp if it isn't one yet if grep.class == String grep = '(/[^/]*)*' + grep if grep[0] != '/' grep = Regexp.new('^' + grep + '(\s|$)') end all_cmds = ps_axo @list = all_cmds.find_all do |hm| hm[:command] =~ grep end end |
Instance Method Details
#list ⇒ Object
41 42 43 44 |
# File 'lib/resources/processes.rb', line 41 def list warn '[DEPRECATION] `processes.list` is deprecated. Please use `processes.entries` instead. It will be removed in version 2.0.0.' @list end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/resources/processes.rb', line 37 def to_s "Processes #{@grep.class == String ? @grep : @grep.inspect}" end |