Sha256: 3af36d2057b7ad7670b401e94d685c7bb0d93d3de725243ed0e417f392f9aeab

Contents?: true

Size: 506 Bytes

Versions: 9

Compression:

Stored size: 506 Bytes

Contents

module SportsDataApi
  module Mlb
    class Player
      attr_reader :team_id
      def initialize(xml, team_id)
        if xml.is_a? Nokogiri::XML::Element
          player_ivar = self.instance_variable_set("@#{xml.name}", {})
          self.class.class_eval { attr_reader :"#{xml.name}" }
          player_ivar[:team_id] = team_id
          xml.attributes.each do | attr_name, attr_value|
            player_ivar[attr_name.to_sym] = attr_value.value
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sports_data_api-0.10.1 lib/sports_data_api/mlb/player.rb
sports_data_api-0.10.0 lib/sports_data_api/mlb/player.rb
sports_data_api-0.9.2 lib/sports_data_api/mlb/player.rb
sports_data_api-0.2.4 lib/sports_data_api/mlb/player.rb
sports_data_api-0.2.3 lib/sports_data_api/mlb/player.rb
sports_data_api-0.2.2 lib/sports_data_api/mlb/player.rb
sports_data_api-0.2.1 lib/sports_data_api/mlb/player.rb
sports_data_api-0.2.0 lib/sports_data_api/mlb/player.rb
sports_data_api-0.1.0 lib/sports_data_api/mlb/player.rb