Sha256: 8a611654333531fb42aa5ced953b6421bb051484007b79e62d732c18651173bf

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

module NflData
  class Team
    attr_accessor :name, :short_name, :schedule

    def to_hash
      {
        name: name,
        short_name: short_name,
        schedule: schedule.nil? ? [] : schedule.to_hash
      }
    end

    class Schedule
      attr_accessor :games

      def initialize
        @games = []
      end

      def to_hash
        @games.map { |game| game.to_hash }
      end

      class Game
        attr_accessor :week, :opponent, :date, :time, :home_game

        def to_hash
          {
            week: week,
            opponent: opponent,
            date: date,
            time: time,
            home_game: home_game
          }
        end
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nfl_data-0.0.9 lib/nfl_data/models/team.rb
nfl_data-0.0.8 lib/nfl_data/models/team.rb