Class: Deck

Inherits:
Array
  • Object
show all
Defined in:
lib/playing_cards/deck.rb

Defined Under Namespace

Modules: ArrayExtensions

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.standardObject



13
14
15
16
17
18
19
20
21
# File 'lib/playing_cards/deck.rb', line 13

def self.standard
  deck = Deck.new
  %w{club diamond heart spade}.each do |suit|
    %w{2 3 4 5 6 7 8 9 10 jack queen king ace}.each do |rank|
      deck << Card.new(rank, suit)
    end
  end
  deck
end

Instance Method Details

#deal_from_bottom(num = 1) ⇒ Object



30
31
32
# File 'lib/playing_cards/deck.rb', line 30

def deal_from_bottom num = 1
  _draw num, :pop
end

#deal_from_top(num = 1) ⇒ Object Also known as: draw, burn



23
24
25
# File 'lib/playing_cards/deck.rb', line 23

def deal_from_top num = 1
  _draw num, :shift
end