Class: Gauguin::ColorsLimiter
- Inherits:
-
Object
- Object
- Gauguin::ColorsLimiter
- Defined in:
- lib/gauguin/colors_limiter.rb
Instance Method Summary collapse
Instance Method Details
#call(colors) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/gauguin/colors_limiter.rb', line 3 def call(colors) colors_limit = Gauguin.configuration.colors_limit if colors.count > colors_limit colors = colors.sort_by { |key, group| key.percentage }. reverse[0..colors_limit - 1] end colors end |