Class: NBA::TeamGameStreak

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/nba/team_game_streak.rb

Overview

Represents a team’s game streak statistics

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#abbreviationString?

Returns the team abbreviation

Examples:

streak.abbreviation #=> "GSW"

Returns:

  • (String, nil)

    the team abbreviation



33
# File 'lib/nba/team_game_streak.rb', line 33

attribute :abbreviation, Shale::Type::String

#active_streakInteger?

Returns whether the streak is active (1 for active, 0 for inactive)

Examples:

streak.active_streak #=> 1

Returns:

  • (Integer, nil)

    1 for active, 0 for inactive



65
# File 'lib/nba/team_game_streak.rb', line 65

attribute :active_streak, Shale::Type::Integer

#end_dateString?

Returns the end date of the streak

Examples:

streak.end_date #=> "2024-02-10"

Returns:

  • (String, nil)

    the end date of the streak



57
# File 'lib/nba/team_game_streak.rb', line 57

attribute :end_date, Shale::Type::String

#first_seasonString?

Returns the first season of the streak

Examples:

streak.first_season #=> "2023-24"

Returns:

  • (String, nil)

    the first season of the streak



89
# File 'lib/nba/team_game_streak.rb', line 89

attribute :first_season, Shale::Type::String

#game_streakInteger?

Returns the number of consecutive games in the streak

Examples:

streak.game_streak #=> 10

Returns:

  • (Integer, nil)

    the number of consecutive games in the streak



41
# File 'lib/nba/team_game_streak.rb', line 41

attribute :game_streak, Shale::Type::Integer

#last_seasonString?

Returns the last season of the streak

Examples:

streak.last_season #=> "2024-25"

Returns:

  • (String, nil)

    the last season of the streak



81
# File 'lib/nba/team_game_streak.rb', line 81

attribute :last_season, Shale::Type::String

#num_seasonsInteger?

Returns the number of seasons the streak spans

Examples:

streak.num_seasons #=> 2

Returns:

  • (Integer, nil)

    the number of seasons the streak spans



73
# File 'lib/nba/team_game_streak.rb', line 73

attribute :num_seasons, Shale::Type::Integer

#start_dateString?

Returns the start date of the streak

Examples:

streak.start_date #=> "2024-01-15"

Returns:

  • (String, nil)

    the start date of the streak



49
# File 'lib/nba/team_game_streak.rb', line 49

attribute :start_date, Shale::Type::String

#team_idInteger?

Returns the team ID

Examples:

streak.team_id #=> 1610612744

Returns:

  • (Integer, nil)

    the team ID



25
# File 'lib/nba/team_game_streak.rb', line 25

attribute :team_id, Shale::Type::Integer

#team_nameString?

Returns the team name

Examples:

streak.team_name #=> "Warriors"

Returns:

  • (String, nil)

    the team’s name



17
# File 'lib/nba/team_game_streak.rb', line 17

attribute :team_name, Shale::Type::String

Instance Method Details

#active?Boolean

Returns whether the streak is currently active

Examples:

streak.active? #=> true

Returns:

  • (Boolean)

    true if the streak is active



97
98
99
# File 'lib/nba/team_game_streak.rb', line 97

def active?
  active_streak.eql?(1)
end

#teamTeam?

Returns the team associated with this streak

Examples:

streak.team #=> #<NBA::Team>

Returns:

  • (Team, nil)

    the team object for this streak



107
108
109
# File 'lib/nba/team_game_streak.rb', line 107

def team
  Teams.find(team_id)
end