Class: GameEngine::Deck
- Inherits:
-
Object
- Object
- GameEngine::Deck
- Defined in:
- lib/smack_engine/deck.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
-
#initialize(deck_data) ⇒ Deck
constructor
A new instance of Deck.
- #shuffle ⇒ Object
Constructor Details
#initialize(deck_data) ⇒ Deck
Returns a new instance of Deck.
4 5 6 |
# File 'lib/smack_engine/deck.rb', line 4 def initialize(deck_data) @list = deck_data.cards.map { |card| GameEngine::Card.new(card) } end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
3 4 5 |
# File 'lib/smack_engine/deck.rb', line 3 def list @list end |
Instance Method Details
#shuffle ⇒ Object
8 9 10 |
# File 'lib/smack_engine/deck.rb', line 8 def shuffle list.shuffle! end |