Class: ColorContrastCalc::ColorFunctionParser::Converter
- Inherits:
-
Object
- Object
- ColorContrastCalc::ColorFunctionParser::Converter
- Defined in:
- lib/color_contrast_calc/color_function_parser.rb
Overview
Hold information about a parsed RGB/HSL/HWB function.
This class is intended to be used internally in ColorFunctionParser, so do not rely on the current class name and its interfaces. They may change in the future.
Instance Attribute Summary collapse
-
#scheme ⇒ String
readonly
Type of function: ‘rgb’ or ‘hsl’.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#rgb ⇒ Array<Integer>
Return the RGB value gained from a RGB/HSL/HWB function.
-
#to_a ⇒ Array<Integer, Float>
Return the parameters of a RGB/HSL/HWB function as an array of Integer/Float.
Instance Attribute Details
#scheme ⇒ String (readonly)
Returns Type of function: ‘rgb’ or ‘hsl’.
168 169 170 |
# File 'lib/color_contrast_calc/color_function_parser.rb', line 168 def scheme @scheme end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
168 |
# File 'lib/color_contrast_calc/color_function_parser.rb', line 168 attr_reader :scheme, :source |
Instance Method Details
#rgb ⇒ Array<Integer>
Return the RGB value gained from a RGB/HSL/HWB function.
195 196 197 |
# File 'lib/color_contrast_calc/color_function_parser.rb', line 195 def rgb raise NotImplementedError, 'Overwrite the method in a subclass' end |
#to_a ⇒ Array<Integer, Float>
Return the parameters of a RGB/HSL/HWB function as an array of Integer/Float. The unit for H, S, L is assumed to be deg, %, % respectively.
207 208 209 |
# File 'lib/color_contrast_calc/color_function_parser.rb', line 207 def to_a @normalized end |