Class: Processes

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/processes.rb

Overview

copyright: 2015, Vulcano Security GmbH author: Dominik Richter author: Christoph Hartmann license: All rights reserved

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(grep) ⇒ Processes

Returns a new instance of Processes.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/resources/processes.rb', line 11

def initialize(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_aux
  @list = all_cmds.find_all do |hm|
    hm[:command] =~ grep
  end
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



10
11
12
# File 'lib/resources/processes.rb', line 10

def list
  @list
end

Instance Method Details

#to_sObject



24
25
26
# File 'lib/resources/processes.rb', line 24

def to_s
  'Processes'
end