Class: Blinkenstein::Runner

Inherits:
Object
  • Object
show all
Includes:
Logging, Celluloid
Defined in:
lib/blinkenstein/runner.rb

Instance Method Summary collapse

Methods included from Logging

#debug, #error, #fatal, #info, #warn

Constructor Details

#initializeRunner

Returns a new instance of Runner.



9
10
11
12
13
14
15
16
# File 'lib/blinkenstein/runner.rb', line 9

def initialize
  register_all
  refresh_all

  every(15) do
    refresh_all
  end
end

Instance Method Details

#finalizeObject



30
31
32
33
34
35
# File 'lib/blinkenstein/runner.rb', line 30

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

#refresh_allObject



25
26
27
28
# File 'lib/blinkenstein/runner.rb', line 25

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

#register_allObject



18
19
20
21
22
23
# File 'lib/blinkenstein/runner.rb', line 18

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