Module: Stalin::Watcher

Defined in:
lib/stalin/watcher.rb,
lib/stalin/watcher/unix_ps.rb,
lib/stalin/watcher/linux_proc_statm.rb

Defined Under Namespace

Classes: LinuxProcStatm, UnixPs

Class Method Summary collapse

Class Method Details

.new(pid) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stalin/watcher.rb', line 3

def self.new(pid)
  it = nil

  constants.each do |konst|
    begin
      konst = const_get(konst)
      it = konst.new(pid)
      break
    rescue Stalin::Unsupported
      next
    end
  end

  it || raise(Stalin::Unsupported, "No compatible Watcher was found among #{constants}")
end