Class: FiftyTwo::Suit::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/fiftytwo/suit/color.rb

Constant Summary collapse

ALL =
[
  RED = new("red", "ff0000"),
  BLACK = new("black", "000000")
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, rgb) ⇒ Color

Returns a new instance of Color.



8
9
10
11
# File 'lib/fiftytwo/suit/color.rb', line 8

def initialize(name, rgb)
  @name = name
  @rgb = rgb
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/fiftytwo/suit/color.rb', line 6

def name
  @name
end

#rgbObject (readonly)

Returns the value of attribute rgb.



6
7
8
# File 'lib/fiftytwo/suit/color.rb', line 6

def rgb
  @rgb
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/fiftytwo/suit/color.rb', line 18

def ==(other)
  name == other.name
end