Method: Inspec::Resources::Processes#initialize
- Defined in:
- lib/resources/processes.rb
#initialize(grep = /.*/) ⇒ Processes
Returns a new instance of Processes.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/resources/processes.rb', line 30 def initialize(grep = /.*/) @grep = grep # turn into a regexp if it isn't one yet if grep.class == String # if windows ignore case as we can't make up our minds if inspec.os.windows? grep = '(?i)' + grep else grep = '(/[^/]*)*' + grep unless grep[0] == '/' grep = '^' + grep + '(\s|$)' end grep = Regexp.new(grep) end all_cmds = ps_axo @list = all_cmds.find_all do |hm| hm[:command] =~ grep end end |