Sha256: 2ceefcf1b4727380e7549e1c2646f0484b9e876a93082fd574937f51f8e27977

Contents?: true

Size: 496 Bytes

Versions: 16

Compression:

Stored size: 496 Bytes

Contents

module SportsDataApi
  module Nhl
    class Games
      include Enumerable
      attr_reader :games, :date

      def initialize(xml)
        @date = xml.first['date']

        @games = xml.xpath("games/game").map do |game_xml|
          Game.new(date: @date, xml: game_xml)
        end
      end

      def each &block
        @games.each do |game|
          if block_given?
            block.call game
          else
            yield game
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sports_data_api-0.12.1 lib/sports_data_api/nhl/games.rb
sports_data_api-0.12.0 lib/sports_data_api/nhl/games.rb
sports_data_api-0.11.6 lib/sports_data_api/nhl/games.rb
sports_data_api-0.11.5 lib/sports_data_api/nhl/games.rb
sports_data_api-0.11.3 lib/sports_data_api/nhl/games.rb
sports_data_api-0.11.2 lib/sports_data_api/nhl/games.rb
sports_data_api-0.11.1 lib/sports_data_api/nhl/games.rb
sports_data_api-0.11.0 lib/sports_data_api/nhl/games.rb
sports_data_api-0.10.1 lib/sports_data_api/nhl/games.rb
sports_data_api-0.10.0 lib/sports_data_api/nhl/games.rb
sports_data_api-0.9.2 lib/sports_data_api/nhl/games.rb
sports_data_api-0.2.4 lib/sports_data_api/nhl/games.rb
sports_data_api-0.2.3 lib/sports_data_api/nhl/games.rb
sports_data_api-0.2.2 lib/sports_data_api/nhl/games.rb
sports_data_api-0.2.1 lib/sports_data_api/nhl/games.rb
sports_data_api-0.2.0 lib/sports_data_api/nhl/games.rb