class Bridge::Deal

Attributes

deck[RW]
hands[RW]

Public Class Methods

from_page() click to toggle source
# File lib/bridge/deal.rb, line 24
def self.from_page
  # create deal and hands based on HEX bridge book page number
end
new() click to toggle source
# File lib/bridge/deal.rb, line 5
def initialize
  @hands = []
  @deck = Deck.new
  Direction.values.each do |dir|
    @hands[Direction.send(dir)] = Hand.new
  end
  deal!
  self
end

Public Instance Methods

deal!() click to toggle source

deals one card per hand on a cycle until we run out of cards

# File lib/bridge/deal.rb, line 16
def deal!
  hands.cycle(deck.size/hands.size) { |hand| hand << deck.shift }
end
method_missing(m, *args, &block) click to toggle source
Calls superclass method
# File lib/bridge/deal.rb, line 28
def method_missing(m, *args, &block)
  if hands.respond_to?(m)
    hands.send(m, *args, &block)
  else
    super
  end
end
to_page() click to toggle source
# File lib/bridge/deal.rb, line 20
def to_page
  # returns HEX bridge book page value
end