Class: NBA::Franchise

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

Overview

Represents franchise history data

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#conf_titlesInteger

Returns the number of conference titles

Examples:

franchise.conf_titles #=> 7

Returns:

  • (Integer)

    the conference titles



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

attribute :conf_titles, Shale::Type::Integer

#div_titlesInteger

Returns the number of division titles

Examples:

franchise.div_titles #=> 12

Returns:

  • (Integer)

    the division titles



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

attribute :div_titles, Shale::Type::Integer

#end_yearInteger

Returns the franchise end year

Examples:

franchise.end_year #=> 2024

Returns:

  • (Integer)

    the end year



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

attribute :end_year, Shale::Type::Integer

#gamesInteger

Returns the total games played

Examples:

franchise.games #=> 5832

Returns:

  • (Integer)

    the total games



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

attribute :games, Shale::Type::Integer

#league_idString

Returns the league ID

Examples:

franchise.league_id #=> "00"

Returns:

  • (String)

    the league ID



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

attribute :league_id, Shale::Type::String

#league_titlesInteger

Returns the number of league/NBA championships

Examples:

franchise.league_titles #=> 7

Returns:

  • (Integer)

    the league championships



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

attribute :league_titles, Shale::Type::Integer

#lossesInteger

Returns the total losses

Examples:

franchise.losses #=> 2852

Returns:

  • (Integer)

    the total losses



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

attribute :losses, Shale::Type::Integer

#po_appearancesInteger

Returns the number of playoff appearances

Examples:

franchise.po_appearances #=> 35

Returns:

  • (Integer)

    the playoff appearances



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

attribute :po_appearances, Shale::Type::Integer

#start_yearInteger

Returns the franchise start year

Examples:

franchise.start_year #=> 1946

Returns:

  • (Integer)

    the start year



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

attribute :start_year, Shale::Type::Integer

#team_cityString

Returns the team city

Examples:

franchise.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



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

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

franchise.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

franchise.team_name #=> "Warriors"

Returns:

  • (String)

    the team name



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

attribute :team_name, Shale::Type::String

#win_pctFloat

Returns the all-time win percentage

Examples:

franchise.win_pct #=> 0.511

Returns:

  • (Float)

    the win percentage



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

attribute :win_pct, Shale::Type::Float

#winsInteger

Returns the total wins

Examples:

franchise.wins #=> 2980

Returns:

  • (Integer)

    the total wins



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

attribute :wins, Shale::Type::Integer

#yearsInteger

Returns the number of years the franchise has existed

Examples:

franchise.years #=> 78

Returns:

  • (Integer)

    the number of years



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

attribute :years, Shale::Type::Integer

Instance Method Details

#teamTeam?

Returns the team object for this franchise

Examples:

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

Returns:

  • (Team, nil)

    the team object



132
133
134
# File 'lib/nba/franchise.rb', line 132

def team
  Teams.find(team_id)
end