Class: Patience::Stock

Inherits:
Area show all
Defined in:
lib/patience/stock.rb

Overview

Patience::Area::Stock creates Stock game object. By now, it’s backed up only with methods from the Area class. Every card in Stock is turned to its back.

stock = Area::Stock.new
stock = Area::Stock.new([Card.new(1, 1)])
stock.cards[0].face_down? #=> true

Instance Attribute Summary

Attributes inherited from Area

#piles

Instance Method Summary collapse

Methods inherited from Area

#add_from, #cards, #draw_on, #hit?, #pos, #pos=

Constructor Details

#initialize(cards) ⇒ Stock

Returns a new instance of Stock.



13
14
15
16
17
# File 'lib/patience/stock.rb', line 13

def initialize(cards)
  super(cards, 1)
  self.piles.first.cards += @cards.shuffle_off!(24).each(&:face_down)
  self.pos = [31, 27]
end