Class: TwentyOne::Card

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

Direct Known Subclasses

FaceCard

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(suit, value = nil) ⇒ Card

Returns a new instance of Card.



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

def initialize(suit, value = nil)
	@suit = suit 
	@value = value
end

Instance Attribute Details

#suitObject (readonly)

Returns the value of attribute suit.



3
4
5
# File 'lib/twenty_one/card.rb', line 3

def suit
  @suit
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/twenty_one/card.rb', line 3

def value
  @value
end

Instance Method Details

#to_sObject



10
11
12
# File 'lib/twenty_one/card.rb', line 10

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