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