Class: TwentyOne::FaceCard

Inherits:
Card
  • Object
show all
Defined in:
lib/twenty_one/face_card.rb

Direct Known Subclasses

AceCard

Instance Attribute Summary collapse

Attributes inherited from Card

#suit, #value

Instance Method Summary collapse

Constructor Details

#initialize(suit, name) ⇒ FaceCard

Returns a new instance of FaceCard.



7
8
9
10
# File 'lib/twenty_one/face_card.rb', line 7

def initialize(suit, name)
  super suit, 10
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/twenty_one/face_card.rb', line 5

def name
  @name
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/twenty_one/face_card.rb', line 12

def to_s
  "#{@name} of #{@suit}"
end