Class: Dogviz::Colorizer

Inherits:
Object
  • Object
show all
Defined in:
lib/dogviz/colorizer.rb

Instance Method Summary collapse

Constructor Details

#initializeColorizer

Returns a new instance of Colorizer.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dogviz/colorizer.rb', line 3

def initialize
  @i = 0
  @colors = %w(#9e0142
#d53e4f
#e45d33
#ed9e61
#762a83
#9970ab
#c6f578
#abdda4
#66c2a5
#3288bd
#5e4fa2)
end

Instance Method Details

#nextObject



18
19
20
21
22
23
# File 'lib/dogviz/colorizer.rb', line 18

def next
  color = @colors[@i]
  @i += 1
  @i = 0 unless @i < @colors.length
  color
end