Class: BracketTree::Match
- Inherits:
-
Object
- Object
- BracketTree::Match
- Defined in:
- lib/bracket_tree/match.rb
Instance Attribute Summary collapse
-
#loser_to ⇒ Object
Returns the value of attribute loser_to.
-
#seats ⇒ Object
Returns the value of attribute seats.
-
#winner_to ⇒ Object
Returns the value of attribute winner_to.
Instance Method Summary collapse
- #include?(seat) ⇒ Boolean (also: #governs?)
-
#initialize(options = {}) ⇒ Match
constructor
A new instance of Match.
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Match
Returns a new instance of Match.
4 5 6 7 8 |
# File 'lib/bracket_tree/match.rb', line 4 def initialize = {} @seats = [:seats] || [] @winner_to = [:winner_to] @loser_to = [:loser_to] end |
Instance Attribute Details
#loser_to ⇒ Object
Returns the value of attribute loser_to.
3 4 5 |
# File 'lib/bracket_tree/match.rb', line 3 def loser_to @loser_to end |
#seats ⇒ Object
Returns the value of attribute seats.
3 4 5 |
# File 'lib/bracket_tree/match.rb', line 3 def seats @seats end |
#winner_to ⇒ Object
Returns the value of attribute winner_to.
3 4 5 |
# File 'lib/bracket_tree/match.rb', line 3 def winner_to @winner_to end |
Instance Method Details
#include?(seat) ⇒ Boolean Also known as: governs?
10 11 12 |
# File 'lib/bracket_tree/match.rb', line 10 def include? seat @seats.include? seat end |
#to_h ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/bracket_tree/match.rb', line 16 def to_h { seats: @seats, winner_to: @winner_to, loser_to: @loser_to } end |