class TheGambler::Deck

Attributes

contents[R]

Public Class Methods

new() click to toggle source

Initializer ————————————————————–

# File lib/the_gambler/deck.rb, line 12
def initialize
  @contents = (0..51).map{|i| Card.new(i)}.shuffle
end

Public Instance Methods

deal() click to toggle source

Public instance methods ————————————————–

# File lib/the_gambler/deck.rb, line 18
def deal
  @contents.pop.tap do |card|
    raise EmptyDeckException.new if card.nil?
  end
end