Class: Color::RGB

Inherits:
Object
  • Object
show all
Defined in:
lib/mc_dot_art_maker/extern_lib_extension.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object

Add to check equality



19
20
21
# File 'lib/mc_dot_art_maker/extern_lib_extension.rb', line 19

def ==(other)
  @r == other.r && @g == other.g && @b == other.b
end

#eql?(other) ⇒ Boolean

Add to use this object for hash key

Returns:

  • (Boolean)


23
24
25
# File 'lib/mc_dot_art_maker/extern_lib_extension.rb', line 23

def eql?(other)
  @r.eql?(other.r) && @g.eql?(other.g) && @b.eql?(other.b)
end

#hashObject



26
27
28
29
30
31
32
# File 'lib/mc_dot_art_maker/extern_lib_extension.rb', line 26

def hash
  code = 17
  code = 37*code + @r.hash
  code = 37*code + @g.hash
  code = 37*code + @b.hash
  code
end