Sha256: 3ab1b802660216ecbdb6886a5ae2c1eb7b22f0ed489e65c0f618c2aae951dc44
Contents?: true
Size: 872 Bytes
Versions: 6
Compression:
Stored size: 872 Bytes
Contents
module SportsDataApi module Mlb class Team attr_reader :id, :name, :market, :alias, :league, :division def initialize(xml) 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['abbr'] @league = xml['league'] @division = xml['division'] 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::Mlb::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