Class: ProcessObserver::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/process_observer/process.rb

Overview

Class representing process.

Direct Known Subclasses

LinuxProcess, WindowsProcess

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Process

Initialize new process.

Parameters:

  • options (Hash)

Options Hash (options):

  • name (String)

    name of the executable or command.

  • pid (Integer)

    process ID.

  • memory (Integer, nil)

    amount of consumed memory.



27
28
29
30
31
# File 'lib/process_observer/process.rb', line 27

def initialize(options)
  @name   = options[:image_name].to_s
  @pid    = options[:pid].to_i
  @memory = options[:memory] ? options[:memory].to_i : nil
end

Instance Attribute Details

#memoryInteger? (readonly)

Returns memory amount of consumed memory.

Returns:

  • (Integer, nil)

    memory amount of consumed memory.



17
18
19
# File 'lib/process_observer/process.rb', line 17

def memory
  @memory
end

#nameString (readonly)

Returns name name of the executable or command.

Returns:

  • (String)

    name name of the executable or command.



9
10
11
# File 'lib/process_observer/process.rb', line 9

def name
  @name
end

#pidInteger (readonly)

Returns pid process ID.

Returns:

  • (Integer)

    pid process ID.



13
14
15
# File 'lib/process_observer/process.rb', line 13

def pid
  @pid
end