Class: BracketTree::Match

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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 options = {}
  @seats = options[:seats] || []
  @winner_to = options[:winner_to]
  @loser_to = options[:loser_to]
end

Instance Attribute Details

#loser_toObject

Returns the value of attribute loser_to.



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

def loser_to
  @loser_to
end

#seatsObject

Returns the value of attribute seats.



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

def seats
  @seats
end

#winner_toObject

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?

Returns:

  • (Boolean)


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

def include? seat
  @seats.include? seat
end

#to_hObject



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