Class: SportsDataApi::Ncaamb::Player
- Inherits:
-
Object
- Object
- SportsDataApi::Ncaamb::Player
- Defined in:
- lib/sports_data_api/ncaamb/player.rb
Instance Attribute Summary collapse
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize(xml) ⇒ Player
constructor
A new instance of Player.
Constructor Details
#initialize(xml) ⇒ Player
Returns a new instance of Player.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sports_data_api/ncaamb/player.rb', line 6 def initialize(xml) if xml.is_a? Nokogiri::XML::Element player_ivar = self.instance_variable_set("@#{xml.name}", {}) self.class.class_eval { attr_reader :"#{xml.name}" } xml.attributes.each do | attr_name, attr_value| player_ivar[attr_name.to_sym] = attr_value.value end stats_xml = xml.xpath('statistics') if stats_xml.is_a? Nokogiri::XML::NodeSet and stats_xml.count > 0 @stats = SportsDataApi::Stats.new(stats_xml.first) end end end |
Instance Attribute Details
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/player.rb', line 4 def stats @stats end |