Sha256: 87b73475fc7e52f9522d136df28bbb6f8a958d635792e8c4e3b657d0494c9474

Contents?: true

Size: 496 Bytes

Versions: 2

Compression:

Stored size: 496 Bytes

Contents

module SportsDataApi
  module Nhl
    class Games
      include Enumerable

      attr_reader :date

      def initialize(json)
        @json = json
        @date = json['date']
      end

      def games
        @games ||= json.fetch('games', []).map do |game_json|
          Game.new(json: game_json)
        end
      end

      def each
        return games.each unless block_given?
        games.each { |game| yield game }
      end

      private

      attr_reader :json
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sports_data_api-0.15.3 lib/sports_data_api/nhl/games.rb
sports_data_api-0.15.2 lib/sports_data_api/nhl/games.rb