Class: SportsDataApi::Ncaamb::TournamentGame

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/sports_data_api/ncaamb/tournament_game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ TournamentGame



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/sports_data_api/ncaamb/tournament_game.rb', line 6

def initialize(args={})
  xml = args.fetch(:xml)
  @bracket = args[:bracket]
  round = args[:round] || {}
  @round_name = round[:name]
  @round_number = round[:number] ? round[:number].to_i : nil

  xml = xml.first if xml.is_a? Nokogiri::XML::NodeSet
  if xml.is_a? Nokogiri::XML::Element
    @id = xml['id']
  end

  super(Game.new(year: args[:year], season: args[:season], xml: xml))
end

Instance Attribute Details

#bracketObject (readonly)

Returns the value of attribute bracket.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament_game.rb', line 4

def bracket
  @bracket
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament_game.rb', line 4

def id
  @id
end

#round_nameObject (readonly)

Returns the value of attribute round_name.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament_game.rb', line 4

def round_name
  @round_name
end

#round_numberObject (readonly)

Returns the value of attribute round_number.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament_game.rb', line 4

def round_number
  @round_number
end