Class: Bigrig::LogTailer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bigrig/log_tailer.rb

Constant Summary collapse

COLORS =
[:green,
:yellow,
:light_blue,
:magenta,
:light_white]

Class Method Summary collapse

Class Method Details

.color_for(name) ⇒ Object



21
22
23
24
# File 'lib/bigrig/log_tailer.rb', line 21

def color_for(name)
  @colors ||= {}
  @colors[name] ||= next_color
end

.create(name) ⇒ Object



17
18
19
# File 'lib/bigrig/log_tailer.rb', line 17

def create(name)
  new name, color_for(name)
end

.next_colorObject



26
27
28
29
30
# File 'lib/bigrig/log_tailer.rb', line 26

def next_color
  @color ||= 0
  @color += 1
  COLORS[(@color - 1) % 5]
end