Module: Yummi::Colorizer
- Included in:
- Yummi::Colorizers::PatternColorizer, Yummi::Colorizers::PercentageColorizer, Yummi::Colorizers::StripeColorizer
- Defined in:
- lib/yummi/colorizers.rb
Overview
A module that defines a colorizer capable component.
Include this module in any component that returns a color in response for :call:.
Instance Method Summary collapse
-
#color_for(arg) ⇒ Object
Returns the color for the given value.
-
#colorize(arg) ⇒ Object
Colorizes a string by passing the arguments to the :call: method to get the proper color.
Instance Method Details
#color_for(arg) ⇒ Object
Returns the color for the given value
Args
A context or a value.
53 54 55 56 |
# File 'lib/yummi/colorizers.rb', line 53 def color_for (arg) arg = Yummi::Context::new(arg) unless arg.is_a? Context call(arg) end |
#colorize(arg) ⇒ Object
Colorizes a string by passing the arguments to the :call: method to get the proper color.
Args
A context or a value.
41 42 43 44 |
# File 'lib/yummi/colorizers.rb', line 41 def colorize (arg) arg = Yummi::Context::new(arg) unless arg.is_a? Context Yummi.colorize arg.value.to_s, color_for(arg) end |