Class: Card
- Inherits:
-
Object
- Object
- Card
- Defined in:
- lib/cardtrick/card.rb
Instance Method Summary collapse
- #card ⇒ Object
-
#initialize(h = {}) ⇒ Card
constructor
A new instance of Card.
- #suit ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
- #value ⇒ Object
Constructor Details
#initialize(h = {}) ⇒ Card
Returns a new instance of Card.
2 3 4 |
# File 'lib/cardtrick/card.rb', line 2 def initialize h={} @card = h end |
Instance Method Details
#card ⇒ Object
8 9 10 |
# File 'lib/cardtrick/card.rb', line 8 def card @card[:card] end |
#suit ⇒ Object
11 12 13 |
# File 'lib/cardtrick/card.rb', line 11 def suit @card[:suit] end |
#to_i ⇒ Object
14 15 16 |
# File 'lib/cardtrick/card.rb', line 14 def to_i @card[:value].to_i end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/cardtrick/card.rb', line 17 def to_s %[#{@card[:card]} of #{@card[:suit]}] end |
#value ⇒ Object
5 6 7 |
# File 'lib/cardtrick/card.rb', line 5 def value @card[:value] end |