class FiftyTwo::Deck

Public Class Methods

standard() click to toggle source
# File lib/fiftytwo/deck.rb, line 10
def standard
  build(FiftyTwo::Rank::ALL.product(FiftyTwo::Suit::ALL))
end

Private Class Methods

build(items) click to toggle source
# File lib/fiftytwo/deck.rb, line 16
def build(items)
  new.tap do |deck|
    items.each do |rank, suit|
      deck << FiftyTwo::Card.new(deck, rank, suit).freeze
    end
  end
end

Public Instance Methods

deal(hands, num_cards = 1) click to toggle source
# File lib/fiftytwo/deck.rb, line 25
def deal(hands, num_cards = 1)
  num_cards.times.each do |card_idx|
    Array(hands).each { |h| h << draw }
  end

  hands
end