Sha256: 043dfabd49ec2b7d580699ca5fdf5ca05a90c94a0284a06cc3a0ae0e5b7a10b9

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 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(&:to_hash)
      end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nfl_data-0.0.14 lib/nfl_data/models/team.rb
nfl_data-0.0.13 lib/nfl_data/models/team.rb
nfl_data-0.0.12 lib/nfl_data/models/team.rb
nfl_data-0.0.11 lib/nfl_data/models/team.rb