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"


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

attribute :conference, Shale::Type::String

#conference_rankInteger

Returns the conference rank

Examples:

standing.conference_rank #=> 5


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

attribute :conference_rank, Shale::Type::Integer

#divisionString

Returns the division

Examples:

standing.division #=> "Pacific"


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"


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

attribute :home_record, Shale::Type::String

#lossesInteger

Returns the number of losses

Examples:

standing.losses #=> 30


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"


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

attribute :road_record, Shale::Type::String

#streakString

Returns the current streak

Examples:

standing.streak #=> "W3"


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

attribute :streak, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

standing.team_id #=> 1610612744


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"


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


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

attribute :win_pct, Shale::Type::Float

#winsInteger

Returns the number of wins

Examples:

standing.wins #=> 45


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"


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

def team
  Teams.find(team_id)
end