Class: Bridge::Deal
- Inherits:
-
Object
- Object
- Bridge::Deal
- Defined in:
- lib/bridge/deal.rb
Overview
deal, not game bidding create the contract bidding is also persistent bidding finishes after 3 passes
Instance Attribute Summary collapse
-
#deck ⇒ Object
Returns the value of attribute deck.
-
#hands ⇒ Object
Returns the value of attribute hands.
Instance Method Summary collapse
-
#deal! ⇒ Object
deals one card per hand on a cycle until we run out of cards.
-
#initialize ⇒ Deal
constructor
A new instance of Deal.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/bridge/deal.rb', line 25 def method_missing(m, *args, &block) if hands.respond_to?(m) hands.send(m, *args, &block) else super end end |
Instance Attribute Details
#deck ⇒ Object
Returns the value of attribute deck.
8 9 10 |
# File 'lib/bridge/deal.rb', line 8 def deck @deck end |
#hands ⇒ Object
Returns the value of attribute hands.
8 9 10 |
# File 'lib/bridge/deal.rb', line 8 def hands @hands end |
Instance Method Details
#deal! ⇒ Object
deals one card per hand on a cycle until we run out of cards
21 22 23 |
# File 'lib/bridge/deal.rb', line 21 def deal! hands.cycle(deck.size/hands.size) { |hand| hand << deck.shift } end |