Sha256: 37dfd10ca8eb09e5eb6e409d793c2d0252ea497bb8c1f2eb84e17ff00bfb57ac
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
module SportsDataApi module Nba class Team attr_reader :id, :name, :market, :alias, :conference, :division, :stats, :players, :points def initialize(xml, conference = nil, division = nil) xml = xml.first if xml.is_a? Nokogiri::XML::NodeSet if xml.is_a? Nokogiri::XML::Element @id = xml['id'] @name = xml['name'] @market = xml['market'] @alias = xml['alias'] @points = xml['points'] ? xml['points'].to_i : nil @conference = conference @division = division @players = xml.xpath("players/player").map do |player_xml| Player.new(player_xml) end end end ## # Compare the Team with another team def ==(other) # Must have an id to compare return false if self.id.nil? if other.is_a? SportsDataApi::Nba::Team return false if other.id.nil? self.id === other.id elsif other.is_a? Symbol self.id.to_sym === other else super(other) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems