Class: NBA::LeagueStanding

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

Overview

Represents a team’s standing with extended information

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#clinch_indicatorString

Returns the clinch indicator

Examples:

standing.clinch_indicator #=> "x"

Returns:

  • (String)

    the clinch indicator



84
# File 'lib/nba/league_standing.rb', line 84

attribute :clinch_indicator, Shale::Type::String

#clinched_conference_titleInteger

Returns if team clinched conference title

Examples:

standing.clinched_conference_title #=> 0

Returns:

  • (Integer)

    1 if clinched, 0 otherwise



212
# File 'lib/nba/league_standing.rb', line 212

attribute :clinched_conference_title, Shale::Type::Integer

#clinched_playoff_birthInteger

Returns if team clinched playoff berth

Examples:

standing.clinched_playoff_birth #=> 1

Returns:

  • (Integer)

    1 if clinched, 0 otherwise



220
# File 'lib/nba/league_standing.rb', line 220

attribute :clinched_playoff_birth, Shale::Type::Integer

#conferenceString

Returns the conference

Examples:

standing.conference #=> "West"

Returns:

  • (String)

    the conference



60
# File 'lib/nba/league_standing.rb', line 60

attribute :conference, Shale::Type::String

#conference_games_backFloat

Returns games back in the conference

Examples:

standing.conference_games_back #=> 12.0

Returns:

  • (Float)

    the games back



204
# File 'lib/nba/league_standing.rb', line 204

attribute :conference_games_back, Shale::Type::Float

#conference_recordString

Returns the conference record

Examples:

standing.conference_record #=> "30-22"

Returns:

  • (String)

    the conference record



68
# File 'lib/nba/league_standing.rb', line 68

attribute :conference_record, Shale::Type::String

#current_streakString

Returns the current streak

Examples:

standing.current_streak #=> "W 2"

Returns:

  • (String)

    the current streak



196
# File 'lib/nba/league_standing.rb', line 196

attribute :current_streak, Shale::Type::String

#diff_points_pgFloat

Returns point differential per game

Examples:

standing.diff_points_pg #=> 1.5

Returns:

  • (Float)

    the point differential



252
# File 'lib/nba/league_standing.rb', line 252

attribute :diff_points_pg, Shale::Type::Float

#divisionString

Returns the division

Examples:

standing.division #=> "Pacific"

Returns:

  • (String)

    the division



92
# File 'lib/nba/league_standing.rb', line 92

attribute :division, Shale::Type::String

#division_rankInteger

Returns the division rank

Examples:

standing.division_rank #=> 3

Returns:

  • (Integer)

    the division rank



108
# File 'lib/nba/league_standing.rb', line 108

attribute :division_rank, Shale::Type::Integer

#division_recordString

Returns the division record

Examples:

standing.division_record #=> "8-8"

Returns:

  • (String)

    the division record



100
# File 'lib/nba/league_standing.rb', line 100

attribute :division_record, Shale::Type::String

#eliminated_conferenceInteger

Returns if team is eliminated from conference

Examples:

standing.eliminated_conference #=> 0

Returns:

  • (Integer)

    1 if eliminated, 0 otherwise



228
# File 'lib/nba/league_standing.rb', line 228

attribute :eliminated_conference, Shale::Type::Integer

#home_recordString

Returns the home record

Examples:

standing.home_record #=> "28-13"

Returns:

  • (String)

    the home record



156
# File 'lib/nba/league_standing.rb', line 156

attribute :home_record, Shale::Type::String

#l10_recordString

Returns the last 10 games record

Examples:

standing.l10_record #=> "6-4"

Returns:

  • (String)

    the L10 record



172
# File 'lib/nba/league_standing.rb', line 172

attribute :l10_record, Shale::Type::String

#league_idString

Returns the league ID

Examples:

standing.league_id #=> "00"

Returns:

  • (String)

    the league ID



12
# File 'lib/nba/league_standing.rb', line 12

attribute :league_id, Shale::Type::String

#league_rankInteger

Returns the league rank

Examples:

standing.league_rank #=> 15

Returns:

  • (Integer)

    the league rank



140
# File 'lib/nba/league_standing.rb', line 140

attribute :league_rank, Shale::Type::Integer

#long_loss_streakInteger

Returns the longest loss streak

Examples:

standing.long_loss_streak #=> 4

Returns:

  • (Integer)

    the longest loss streak



188
# File 'lib/nba/league_standing.rb', line 188

attribute :long_loss_streak, Shale::Type::Integer

#long_win_streakInteger

Returns the longest win streak

Examples:

standing.long_win_streak #=> 7

Returns:

  • (Integer)

    the longest win streak



180
# File 'lib/nba/league_standing.rb', line 180

attribute :long_win_streak, Shale::Type::Integer

#lossesInteger

Returns the number of losses

Examples:

standing.losses #=> 36

Returns:

  • (Integer)

    the losses



124
# File 'lib/nba/league_standing.rb', line 124

attribute :losses, Shale::Type::Integer

#opp_points_pgFloat

Returns opponent points per game

Examples:

standing.opp_points_pg #=> 117.2

Returns:

  • (Float)

    the opponent points per game



244
# File 'lib/nba/league_standing.rb', line 244

attribute :opp_points_pg, Shale::Type::Float

#playoff_rankInteger

Returns the playoff rank

Examples:

standing.playoff_rank #=> 10

Returns:

  • (Integer)

    the playoff rank



76
# File 'lib/nba/league_standing.rb', line 76

attribute :playoff_rank, Shale::Type::Integer

#points_pgFloat

Returns points per game

Examples:

standing.points_pg #=> 118.7

Returns:

  • (Float)

    the points per game



236
# File 'lib/nba/league_standing.rb', line 236

attribute :points_pg, Shale::Type::Float

#recordString

Returns the full record string

Examples:

standing.record #=> "46-36"

Returns:

  • (String)

    the record



148
# File 'lib/nba/league_standing.rb', line 148

attribute :record, Shale::Type::String

#road_recordString

Returns the road record

Examples:

standing.road_record #=> "18-23"

Returns:

  • (String)

    the road record



164
# File 'lib/nba/league_standing.rb', line 164

attribute :road_record, Shale::Type::String

#season_idString

Returns the season ID

Examples:

standing.season_id #=> "22024"

Returns:

  • (String)

    the season ID



20
# File 'lib/nba/league_standing.rb', line 20

attribute :season_id, Shale::Type::String

#team_cityString

Returns the team city

Examples:

standing.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



36
# File 'lib/nba/league_standing.rb', line 36

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

standing.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



28
# File 'lib/nba/league_standing.rb', line 28

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

standing.team_name #=> "Warriors"

Returns:

  • (String)

    the team name



44
# File 'lib/nba/league_standing.rb', line 44

attribute :team_name, Shale::Type::String

#team_slugString

Returns the team slug

Examples:

standing.team_slug #=> "warriors"

Returns:

  • (String)

    the team slug



52
# File 'lib/nba/league_standing.rb', line 52

attribute :team_slug, Shale::Type::String

#win_pctFloat

Returns the win percentage

Examples:

standing.win_pct #=> 0.561

Returns:

  • (Float)

    the win percentage



132
# File 'lib/nba/league_standing.rb', line 132

attribute :win_pct, Shale::Type::Float

#winsInteger

Returns the number of wins

Examples:

standing.wins #=> 46

Returns:

  • (Integer)

    the wins



116
# File 'lib/nba/league_standing.rb', line 116

attribute :wins, Shale::Type::Integer

Instance Method Details

#full_nameString

Returns the full team name

Examples:

standing.full_name #=> "Golden State Warriors"

Returns:

  • (String)

    the full name



270
271
272
# File 'lib/nba/league_standing.rb', line 270

def full_name
  "#{team_city} #{team_name}".strip
end

#playoffs?Boolean

Returns whether the team made the playoffs

Examples:

standing.playoffs? #=> true

Returns:

  • (Boolean)

    true if in playoffs



280
281
282
# File 'lib/nba/league_standing.rb', line 280

def playoffs?
  clinched_playoff_birth.eql?(1)
end

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



260
261
262
# File 'lib/nba/league_standing.rb', line 260

def team
  Teams.find(team_id)
end