class HealthBit::Check

Attributes

handler[R]
name[R]

Public Class Methods

new(name, handler) click to toggle source
# File lib/health_bit/check.rb, line 7
def initialize(name, handler)
  @name = name
  @handler = handler
end

Public Instance Methods

call() click to toggle source

@return [nil] if its ok @return [CheckError] if not

# File lib/health_bit/check.rb, line 14
def call
  raise('The check has returned a negative value') unless handler.call
rescue Exception => e # rubocop:disable Lint/RescueException
  CheckError.new(name, exception: e)
end