Method: NFL::LiveUpdate::ScoreStrip::Games#initialize

Defined in:
lib/nfl/live_update/score_strip/games.rb

#initialize(xml) ⇒ Games

Returns a new instance of Games.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nfl/live_update/score_strip/games.rb', line 13

def initialize(xml)
  gms = xml.xpath("//ss//gms").first

  attributes = gms.attributes
  attributes.each do |k,v|
    attributes[k] = v.text
  end

  @week = attributes["w"]
  @year = attributes["y"]
  @type = attributes["t"]
  @gd = attributes["gd"]
  @bph = attributes["bph"]
  @bf = attributes["bf"]

  @games = gms.xpath("//g").map {|g| Game.new(g) }
end