Class: NBA::Standing

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

Overview

Represents a team’s standing in the league

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#conferenceString

Returns the conference

Examples:

standing.conference #=> "West"

Returns:

  • (String)

    the conference



32
# File 'lib/nba/standing.rb', line 32

attribute :conference, Shale::Type::String

#conference_rankInteger

Returns the conference rank

Examples:

standing.conference_rank #=> 5

Returns:

  • (Integer)

    the conference rank



72
# File 'lib/nba/standing.rb', line 72

attribute :conference_rank, Shale::Type::Integer

#divisionString

Returns the division

Examples:

standing.division #=> "Pacific"

Returns:

  • (String)

    the division



40
# File 'lib/nba/standing.rb', line 40

attribute :division, Shale::Type::String

#home_recordString

Returns the home record

Examples:

standing.home_record #=> "25-12"

Returns:

  • (String)

    the home record



80
# File 'lib/nba/standing.rb', line 80

attribute :home_record, Shale::Type::String

#lossesInteger

Returns the number of losses

Examples:

standing.losses #=> 30

Returns:

  • (Integer)

    the number of losses



56
# File 'lib/nba/standing.rb', line 56

attribute :losses, Shale::Type::Integer

#road_recordString

Returns the road record

Examples:

standing.road_record #=> "20-18"

Returns:

  • (String)

    the road record



88
# File 'lib/nba/standing.rb', line 88

attribute :road_record, Shale::Type::String

#streakString

Returns the current streak

Examples:

standing.streak #=> "W3"

Returns:

  • (String)

    the current streak



96
# File 'lib/nba/standing.rb', line 96

attribute :streak, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

standing.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



16
# File 'lib/nba/standing.rb', line 16

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

standing.team_name #=> "Golden State Warriors"

Returns:

  • (String)

    the team name



24
# File 'lib/nba/standing.rb', line 24

attribute :team_name, Shale::Type::String

#win_pctFloat

Returns the win percentage

Examples:

standing.win_pct #=> 0.600

Returns:

  • (Float)

    the win percentage



64
# File 'lib/nba/standing.rb', line 64

attribute :win_pct, Shale::Type::Float

#winsInteger

Returns the number of wins

Examples:

standing.wins #=> 45

Returns:

  • (Integer)

    the number of wins



48
# File 'lib/nba/standing.rb', line 48

attribute :wins, Shale::Type::Integer

Instance Method Details

#teamTeam?

Returns the team object for this standing

Examples:

standing.team #=> #<NBA::Team>
standing.team.city #=> "San Francisco"

Returns:

  • (Team, nil)

    the team object



105
106
107
# File 'lib/nba/standing.rb', line 105

def team
  Teams.find(team_id)
end