Class: ColorContrastCalc::Sorter::CachingCompiler

Inherits:
CompareFunctionCompiler show all
Defined in:
lib/color_contrast_calc/sorter.rb

Instance Method Summary collapse

Methods inherited from CompareFunctionCompiler

#compile, #initialize

Constructor Details

This class inherits a constructor from ColorContrastCalc::Sorter::CompareFunctionCompiler

Instance Method Details

#create_proc(order, color_order) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
# File 'lib/color_contrast_calc/sorter.rb', line 171

def create_proc(order, color_order)
  converter = select_converter(color_order)
  cache = {}

  proc do |color1, color2|
    c1 = to_components(color1, converter, cache)
    c2 = to_components(color2, converter, cache)

    compare(c1, c2, order)
  end
end