Sha256: c9e9b5818c8062e4f4fa3028e9d24853beb8719066d75886053707d8e548f6f5

Contents?: true

Size: 654 Bytes

Versions: 15

Compression:

Stored size: 654 Bytes

Contents

module SportsDataApi
  module Nba
    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

15 entries across 15 versions & 1 rubygems

Version Path
sports_data_api-0.11.6 lib/sports_data_api/nba/player.rb
sports_data_api-0.11.5 lib/sports_data_api/nba/player.rb
sports_data_api-0.11.3 lib/sports_data_api/nba/player.rb
sports_data_api-0.11.2 lib/sports_data_api/nba/player.rb
sports_data_api-0.11.1 lib/sports_data_api/nba/player.rb
sports_data_api-0.11.0 lib/sports_data_api/nba/player.rb
sports_data_api-0.10.1 lib/sports_data_api/nba/player.rb
sports_data_api-0.10.0 lib/sports_data_api/nba/player.rb
sports_data_api-0.9.2 lib/sports_data_api/nba/player.rb
sports_data_api-0.2.4 lib/sports_data_api/nba/player.rb
sports_data_api-0.2.3 lib/sports_data_api/nba/player.rb
sports_data_api-0.2.2 lib/sports_data_api/nba/player.rb
sports_data_api-0.2.1 lib/sports_data_api/nba/player.rb
sports_data_api-0.2.0 lib/sports_data_api/nba/player.rb
sports_data_api-0.1.0 lib/sports_data_api/nba/player.rb