Sha256: d5b919b07359f4633d4e23462d493eb179918c9efed687643b1b13f4ebb6ba18

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

require 'celluloid'
require 'blink1'

module Blinkenstein 
  class Runner 
    include Celluloid
    include Logging

    def initialize
      register_all
      refresh_all

      every(15) do
        refresh_all
      end
    end

    def register_all
      @monitors = Monitor.monitors.map do |monitor|
        info "Registering montitor: #{monitor}"
        monitor.new
      end
    end

    def refresh_all
      debug "Refreshing all monitors"
      @monitors.each(&:refresh)
    end

    def finalize
      info "Shutting down. Turning off the lights..."
      Blink1.open do |blink1|
        blink1.off
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blinkenstein-0.2.4 lib/blinkenstein/runner.rb
blinkenstein-0.2.3 lib/blinkenstein/runner.rb
blinkenstein-0.2.2 lib/blinkenstein/runner.rb
blinkenstein-0.2.1 lib/blinkenstein/runner.rb