Sha256: 231a0f2944d91f8ad6a51750a6742a18d32bd6c9cd98d49eefe14f3543e025af
Contents?: true
Size: 749 Bytes
Versions: 1
Compression:
Stored size: 749 Bytes
Contents
require 'time' Dir[File.dirname(__FILE__) + '/ekg/*.rb'].each {|file| require file } module Ekg class << self attr_accessor :config def lub_dub Ekg::Data.send_data( { name: Ekg.config[:name], version: Ekg.config[:version], time: Time.now } ) rescue end def time_since_last_heartbeat return nil unless time = the_last_heartbeat_time Time.now - time end private def the_last_heartbeat_time Time.parse the_last_heartbeat_record['time'] rescue nil end def the_last_heartbeat_record records = Ekg::Data.receive_data records.select { |x| x['name'] == Ekg.config[:name] }.first end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ekg-1.1.1 | lib/ekg.rb |