Class: Blinkenstein::EveSkillQueueMonitor

Inherits:
Object
  • Object
show all
Includes:
Logging, Monitor
Defined in:
lib/blinkenstein/monitors/eve_skill_queue_monitor.rb

Instance Method Summary collapse

Methods included from Logging

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

Methods included from Monitor

included

Constructor Details

#initializeEveSkillQueueMonitor

Returns a new instance of EveSkillQueueMonitor.



10
11
12
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 10

def initialize
  @skillQueue ||= Eve::SkillQueue.new
end

Instance Method Details

#coolObject



32
33
34
35
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 32

def cool 
  info "Everything is cool. #{hours_left}h left."
  Blink::Patterns.breath("#00ff00", 4, 0.2)
end

#failureObject



47
48
49
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 47

def failure 
  Blink::Patterns.breath("#ff0000", 0.25, 0.75)
end

#hours_leftObject



18
19
20
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 18

def hours_left
  @skillQueue.hours_left
end

#nervousObject



37
38
39
40
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 37

def nervous
  info "There's room in the queue. #{hours_left}h left."
  Blink::Patterns.breath("#ff0000", 3, 0.3)
end

#panicObject



42
43
44
45
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 42

def panic
  info "Queue runs out soon. #{hours_left}h left."
  Blink::Patterns.police
end

#refreshObject



14
15
16
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 14

def refresh 
  update_blink
end


22
23
24
25
26
27
28
29
30
# File 'lib/blinkenstein/monitors/eve_skill_queue_monitor.rb', line 22

def update_blink
  case 
  when hours_left == nil then raise "wut"
  when hours_left < 0 then failure
  when hours_left < 8 && hours_left >= 0  then panic
  when hours_left > 8 && hours_left <= 24 then nervous
  when hours_left > 24 then cool 
  end
end