class Ops::Heartbeat

Public Class Methods

add(name, &block) click to toggle source
# File lib/ops/heartbeat.rb, line 4
def add(name, &block)
  instance.add name, &block
end
check(name) click to toggle source
# File lib/ops/heartbeat.rb, line 8
def check(name)
  instance.check(name)
end
instance() click to toggle source
# File lib/ops/heartbeat.rb, line 12
def instance
  @singleton ||= new
end

Public Instance Methods

add(name, &block) click to toggle source
# File lib/ops/heartbeat.rb, line 21
def add(name, &block)
  heartbeats[name] = block
end
check(name) click to toggle source
# File lib/ops/heartbeat.rb, line 25
def check(name)
  return heartbeats[name.to_sym].call
rescue StandardError => e
  puts "Error: #{e}\n#{e.backtrace[2..-1].join("\n")}" unless heartbeats[name.to_sym].nil?
  return false
end
heartbeats() click to toggle source
# File lib/ops/heartbeat.rb, line 17
def heartbeats
  @heartbeats ||= {}
end