Class: Rx::Check::GenericCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/rx/check/generic_check.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callable, name = "generic", timeout = 0) ⇒ GenericCheck

Returns a new instance of GenericCheck.



8
9
10
11
12
# File 'lib/rx/check/generic_check.rb', line 8

def initialize(callable, name = "generic", timeout = 0)
  @callable = callable
  @name = name
  @timeout = timeout
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/rx/check/generic_check.rb', line 6

def name
  @name
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



6
7
8
# File 'lib/rx/check/generic_check.rb', line 6

def timeout
  @timeout
end

Instance Method Details

#checkObject



14
15
16
17
18
# File 'lib/rx/check/generic_check.rb', line 14

def check
  Result.from(name) do
    Timeout::timeout(timeout) { callable.call }
  end
end