Class: Yummi::Colorizers::StripeColorizer
- Inherits:
-
Object
- Object
- Yummi::Colorizers::StripeColorizer
- Includes:
- Yummi::Colorizer
- Defined in:
- lib/yummi/colorizers.rb
Overview
A colorizer that cycles through colors to create a striped effect
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize(*colors) ⇒ StripeColorizer
constructor
Creates a new colorizer using the given colors.
Methods included from Yummi::Colorizer
Constructor Details
#initialize(*colors) ⇒ StripeColorizer
Creates a new colorizer using the given colors
347 348 349 350 351 |
# File 'lib/yummi/colorizers.rb', line 347 def initialize (*colors) @colors = colors.flatten @colors = [nil] if @colors.empty? @count = -1 end |
Instance Method Details
#call(*args) ⇒ Object
353 354 355 356 |
# File 'lib/yummi/colorizers.rb', line 353 def call *args @count += 1 @colors[@count % @colors.size] end |