Class: Chroma::PaletteBuilder::PaletteEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/chroma/palette_builder.rb

Overview

Internal class for delaying evaluating a color to generate a final palette

Instance Method Summary collapse

Constructor Details

#initializePaletteEvaluator

Returns a new instance of PaletteEvaluator.



31
32
33
# File 'lib/chroma/palette_builder.rb', line 31

def initialize
  @conversions = []
end

Instance Method Details

#<<(conversion) ⇒ Object



35
36
37
# File 'lib/chroma/palette_builder.rb', line 35

def <<(conversion)
  @conversions << conversion
end

#evaluate(color) ⇒ Object



39
40
41
42
43
# File 'lib/chroma/palette_builder.rb', line 39

def evaluate(color)
  @conversions.map do |color_calls|
    color_calls.evaluate(color)
  end.unshift(color)
end