Method: Color::CMYK#==
- Defined in:
- lib/coloration/color/cmyk.rb
#==(other) ⇒ Object
Compares the other colour to this one. The other colour will be converted to CMYK before comparison, so the comparison between a CMYK colour and a non-CMYK colour will be approximate and based on the other colour’s #to_cmyk conversion. If there is no #to_cmyk conversion, this will raise an exception. This will report that two CMYK colours are equivalent if all component values are within 1e-4 (0.0001) of each other.
29 30 31 32 33 34 35 36 |
# File 'lib/coloration/color/cmyk.rb', line 29 def ==(other) other = other.to_cmyk other.kind_of?(Color::CMYK) and ((@c - other.c).abs <= 1e-4) and ((@m - other.m).abs <= 1e-4) and ((@y - other.y).abs <= 1e-4) and ((@k - other.k).abs <= 1e-4) end |