Method: Color::GrayScale#==
- Defined in:
- lib/coloration/color/grayscale.rb
#==(other) ⇒ Object
Compares the other colour to this one. The other colour will be converted to GreyScale before comparison, so the comparison between a GreyScale colour and a non-GreyScale colour will be approximate and based on the other colour’s #to_greyscale conversion. If there is no #to_greyscale conversion, this will raise an exception. This will report that two GreyScale values are equivalent if they are within 1e-4 (0.0001) of each other.
43 44 45 46 47 |
# File 'lib/coloration/color/grayscale.rb', line 43 def ==(other) other = other.to_grayscale other.kind_of?(Color::GrayScale) and ((@g - other.g).abs <= 1e-4) end |