class Team
Attributes
batters[R]
errors[R]
hits[R]
linescore[R]
name[R]
pitchers[R]
runs[R]
Public Class Methods
new(boxscore, flag)
click to toggle source
# File lib/mlb_gd2/team.rb, line 13 def initialize(boxscore, flag) @name = boxscore.attribute("#{flag}_fname").value @linescore = boxscore.xpath("//inning_line_score").map { |inning| inning["#{flag}"] } @runs = boxscore.xpath("//linescore").first.attribute("#{flag}_team_runs").value @hits = boxscore.xpath("//linescore").first.attribute("#{flag}_team_hits").value @errors = boxscore.xpath("//linescore").first.attribute("#{flag}_team_errors").value @batters = boxscore.search("batting[team_flag='#{flag}']>batter").map { |batter_xml| Batter.new(batter_xml) } @pitchers = boxscore.search("pitching[team_flag='#{flag}']>pitcher").map { |pitcher_xml| Pitcher.new(pitcher_xml) } end