Class: Bridge::Trick
- Inherits:
-
Object
- Object
- Bridge::Trick
- Defined in:
- lib/bridge/trick.rb
Instance Attribute Summary collapse
-
#cards ⇒ Object
readonly
Returns the value of attribute cards.
-
#suit ⇒ Object
readonly
Returns the value of attribute suit.
Instance Method Summary collapse
- #complete? ⇒ Boolean
- #incomplete? ⇒ Boolean
-
#initialize(*args) ⇒ Trick
constructor
A new instance of Trick.
- #winner(trump = nil) ⇒ Object
Constructor Details
Instance Attribute Details
#cards ⇒ Object (readonly)
Returns the value of attribute cards.
3 4 5 |
# File 'lib/bridge/trick.rb', line 3 def cards @cards end |
#suit ⇒ Object (readonly)
Returns the value of attribute suit.
3 4 5 |
# File 'lib/bridge/trick.rb', line 3 def suit @suit end |
Instance Method Details
#complete? ⇒ Boolean
14 15 16 |
# File 'lib/bridge/trick.rb', line 14 def complete? cards.size == 4 end |
#incomplete? ⇒ Boolean
18 19 20 |
# File 'lib/bridge/trick.rb', line 18 def incomplete? !complete? end |
#winner(trump = nil) ⇒ Object
10 11 12 |
# File 'lib/bridge/trick.rb', line 10 def winner(trump = nil) winner_in_suit(trump) || winner_in_suit(suit) end |