Class: Simplicard::Card
- Inherits:
-
Object
- Object
- Simplicard::Card
- Defined in:
- lib/simplicard.rb
Constant Summary collapse
- ACE =
1- JACK =
11- QUEEN =
12- KING =
13- VALID_VALUES =
VALID_SUITS = [SPADES,CLUBS,DIAMONDS,HEARTS]
[2,3,4,5,6,7,8,9,10,JACK,QUEEN,KING,ACE]
Instance Attribute Summary collapse
-
#suit ⇒ Object
readonly
this is the facevalue and suit of the card.
-
#value ⇒ Object
readonly
this is the facevalue and suit of the card.
Instance Method Summary collapse
- #get_suit ⇒ Object
-
#get_value ⇒ Object
this returns the value of the card.
-
#initialize(value, s) ⇒ Card
constructor
A new instance of Card.
- #is_an_ace? ⇒ Boolean
- #is_face_card? ⇒ Boolean
- #show ⇒ Object
- #value_to_s ⇒ Object
Constructor Details
Instance Attribute Details
#suit ⇒ Object (readonly)
this is the facevalue and suit of the card
58 59 60 |
# File 'lib/simplicard.rb', line 58 def suit @suit end |
#value ⇒ Object (readonly)
this is the facevalue and suit of the card
58 59 60 |
# File 'lib/simplicard.rb', line 58 def value @value end |
Instance Method Details
#get_suit ⇒ Object
72 73 74 |
# File 'lib/simplicard.rb', line 72 def get_suit @suit end |
#get_value ⇒ Object
this returns the value of the card. Depends on the game, the get_value can return different value than the facevalue
69 70 71 |
# File 'lib/simplicard.rb', line 69 def get_value @value end |
#is_an_ace? ⇒ Boolean
105 106 107 |
# File 'lib/simplicard.rb', line 105 def is_an_ace? return true if @value == ACE end |
#is_face_card? ⇒ Boolean
97 98 99 100 101 102 103 |
# File 'lib/simplicard.rb', line 97 def is_face_card? if [JACK,QUEEN,KING].include?(@value) return true else return false end end |
#show ⇒ Object
93 94 95 |
# File 'lib/simplicard.rb', line 93 def show return "#{value_to_s} of #{@suit.suit_to_s}" end |