Class: GameShuffleCards::Card
- Inherits:
-
Object
- Object
- GameShuffleCards::Card
- Defined in:
- lib/game_shuffle_cards/card.rb
Overview
Instance Attribute Summary collapse
-
#card_value ⇒ Object
readonly
Returns the value of attribute card_value.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#suit ⇒ Object
readonly
Returns the value of attribute suit.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(card_value, suit) ⇒ Card
constructor
Create a new card.
Constructor Details
#initialize(card_value, suit) ⇒ Card
Create a new card
10 11 12 13 14 |
# File 'lib/game_shuffle_cards/card.rb', line 10 def initialize(card_value,suit) @id= card_value + ' of ' + suit @card_value=card_value @suit=suit end |
Instance Attribute Details
#card_value ⇒ Object (readonly)
Returns the value of attribute card_value.
15 16 17 |
# File 'lib/game_shuffle_cards/card.rb', line 15 def card_value @card_value end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/game_shuffle_cards/card.rb', line 15 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
15 16 17 |
# File 'lib/game_shuffle_cards/card.rb', line 15 def image @image end |
#suit ⇒ Object (readonly)
Returns the value of attribute suit.
15 16 17 |
# File 'lib/game_shuffle_cards/card.rb', line 15 def suit @suit end |
Class Method Details
.image(id) ⇒ Object
21 22 23 |
# File 'lib/game_shuffle_cards/card.rb', line 21 def image(id) id.tr(' ','_') + '.png' end |