Class: GameShuffleCards::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/game_shuffle_cards/card.rb

Overview

Author:

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Card) initialize(card_value, suit)

Create a new card

Parameters:

  • card_value (String)
  • suit (String)


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