Method: Inspec::Resources::Processes#initialize
- Defined in:
- lib/resources/processes.rb
#initialize(grep) ⇒ Processes
Returns a new instance of Processes.
| 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # File 'lib/resources/processes.rb', line 23 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 |