Class: GlimmerKlondikeSolitaire::Model::DealingPile
- Inherits:
-
Object
- Object
- GlimmerKlondikeSolitaire::Model::DealingPile
- Defined in:
- app/glimmer_klondike_solitaire/model/dealing_pile.rb
Constant Summary collapse
- DEALING_INITIAL_COUNT =
24
Instance Method Summary collapse
- #deal! ⇒ Object
-
#initialize(game) ⇒ DealingPile
constructor
A new instance of DealingPile.
- #playing_cards ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize(game) ⇒ DealingPile
Returns a new instance of DealingPile.
6 7 8 9 |
# File 'app/glimmer_klondike_solitaire/model/dealing_pile.rb', line 6 def initialize(game) @game = game reset! end |
Instance Method Details
#deal! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/glimmer_klondike_solitaire/model/dealing_pile.rb', line 16 def deal! = .shift if .nil? @game.dealt_pile..each do || << end @game.dealt_pile..clear else @game.dealt_pile.push!() end end |
#playing_cards ⇒ Object
28 29 30 |
# File 'app/glimmer_klondike_solitaire/model/dealing_pile.rb', line 28 def @playing_cards ||= [] end |
#reset! ⇒ Object
11 12 13 14 |
# File 'app/glimmer_klondike_solitaire/model/dealing_pile.rb', line 11 def reset! .clear DEALING_INITIAL_COUNT.times { << @game.deck.pop } end |