Class: Hermann::Timeout

Inherits:
Object
  • Object
show all
Defined in:
lib/hermann/timeout.rb

Class Method Summary collapse

Class Method Details

.system_timer?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/hermann/timeout.rb', line 24

def self.system_timer?
  Hermann::Timeout::USE_SYSTEM_TIMER
end

.timeout(seconds, klass = nil, &block) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/hermann/timeout.rb', line 28

def self.timeout(seconds, klass=nil, &block)
  if system_timer?
    SystemTimer.timeout_after(seconds, klass, &block)
  else
    ::Timeout.timeout(seconds, klass, &block)
  end
end