Class: TwentyOne::Card
- Inherits:
-
Object
- Object
- TwentyOne::Card
- Defined in:
- lib/twenty_one/card.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#suit ⇒ Object
readonly
Returns the value of attribute suit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(suit, value = nil) ⇒ Card
constructor
A new instance of Card.
- #to_s ⇒ Object
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
#suit ⇒ Object (readonly)
Returns the value of attribute suit.
3 4 5 |
# File 'lib/twenty_one/card.rb', line 3 def suit @suit end |
#value ⇒ Object (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_s ⇒ Object
10 11 12 |
# File 'lib/twenty_one/card.rb', line 10 def to_s "#{@value} of #{@suit}" end |