Class: Nagios::RunnerAsync

Inherits:
Runner
  • Object
show all
Defined in:
lib/nagios_helper/runner_async.rb

Class Method Summary collapse

Methods inherited from Runner

#initialize

Constructor Details

This class inherits a constructor from Nagios::Runner

Class Method Details

.check(params = {}) ⇒ Object

synchrony check, for manual call do not run in EM



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nagios_helper/runner_async.rb', line 7

def self.check(params = {})
  raise "cant check sync in running EM" if EM.reactor_running?

  result = nil 
  EM.run do
    self.new(params) do |res|
      begin
        result = res
      ensure
        EM.stop
      end        
    end
  end
  
  result
end