Sha256: 28549b98988b220df9457a2b1337736c1c418026e19f8f09789231138787a1c9

Contents?: true

Size: 496 Bytes

Versions: 2

Compression:

Stored size: 496 Bytes

Contents

module SportsDataApi
  module Nba
    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/nba/games.rb
sports_data_api-0.15.2 lib/sports_data_api/nba/games.rb