Sha256: 502bcaa33d282de7c06da207fb387fb8b79ba2096b8eb00ff30eef753c400316

Contents?: true

Size: 657 Bytes

Versions: 22

Compression:

Stored size: 657 Bytes

Contents

module SportsDataApi
  module Ncaamb
    class Player
      attr_reader :stats

      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
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
sports_data_api-0.15.3 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.15.2 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.15.1 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.15.0 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.14.1 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.14.0 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.13.0 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.12.1 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.12.0 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.11.6 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.11.5 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.11.3 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.11.2 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.11.1 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.11.0 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.10.1 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.10.0 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.9.2 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.2.4 lib/sports_data_api/ncaamb/player.rb
sports_data_api-0.2.3 lib/sports_data_api/ncaamb/player.rb