Class: GameShuffleCards::Card

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

Overview

Author:

  • Diego Hernán Piccinini Lagos

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card_value, suit) ⇒ Card

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

#card_valueObject (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

#idObject (readonly)

Returns the value of attribute id.



15
16
17
# File 'lib/game_shuffle_cards/card.rb', line 15

def id
  @id
end

#imageObject (readonly)

Returns the value of attribute image.



15
16
17
# File 'lib/game_shuffle_cards/card.rb', line 15

def image
  @image
end

#suitObject (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