Class: Dealer

Inherits:
Object
  • Object
show all
Defined in:
lib/dealer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDealer

Returns a new instance of Dealer.



5
6
7
8
# File 'lib/dealer.rb', line 5

def initialize 
  @deck = Deck.new
  @hand = Hand.new
end

Instance Attribute Details

#deckObject

Returns the value of attribute deck.



3
4
5
# File 'lib/dealer.rb', line 3

def deck
  @deck
end

#handObject

Returns the value of attribute hand.



3
4
5
# File 'lib/dealer.rb', line 3

def hand
  @hand
end

Instance Method Details

#dealObject Also known as: river, turn



27
28
29
# File 'lib/dealer.rb', line 27

def deal
  @hand.cards << @deck.cards.pop
end

#deal_to_player(player) ⇒ Object



10
11
12
# File 'lib/dealer.rb', line 10

def deal_to_player(player)
  player.cards << @deck.cards.pop
end

#flopObject



14
15
16
# File 'lib/dealer.rb', line 14

def flop
  3.times{ |n| deal }
end

#initial_trucoObject



18
19
20
# File 'lib/dealer.rb', line 18

def initial_truco
  3.times { |n| player.cards << @deck.cards.pop  }
end