Sha256: a764d55c99a127c5d0f327e0bf848646780c1852de4663a8d4263179de2567f5
Contents?: true
Size: 1.07 KB
Versions: 18
Compression:
Stored size: 1.07 KB
Contents
module SportsDataApi module Ncaamb 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 id.nil? if other.is_a? SportsDataApi::Ncaamb::Team other.id && id === other.id elsif other.is_a? Symbol id.to_sym === other else super(other) end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems