Class: NBA::AllTimeLeader

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

Overview

Represents an all-time statistical leader

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#categoryString

Returns the statistical category

Examples:

leader.category #=> "PTS"

Returns:

  • (String)

    the category



31
# File 'lib/nba/all_time_leader.rb', line 31

attribute :category, Shale::Type::String

#is_activeBoolean

Returns whether the player is active

Examples:

leader.is_active #=> true

Returns:

  • (Boolean)

    whether active



55
# File 'lib/nba/all_time_leader.rb', line 55

attribute :is_active, Shale::Type::Boolean

#player_idInteger

Returns the player ID

Examples:

leader.player_id #=> 2544

Returns:

  • (Integer)

    the player ID



15
# File 'lib/nba/all_time_leader.rb', line 15

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

leader.player_name #=> "LeBron James"

Returns:

  • (String)

    the player name



23
# File 'lib/nba/all_time_leader.rb', line 23

attribute :player_name, Shale::Type::String

#rankInteger

Returns the ranking position

Examples:

leader.rank #=> 1

Returns:

  • (Integer)

    the rank



47
# File 'lib/nba/all_time_leader.rb', line 47

attribute :rank, Shale::Type::Integer

#valueFloat

Returns the stat value

Examples:

leader.value #=> 40474

Returns:

  • (Float)

    the value



39
# File 'lib/nba/all_time_leader.rb', line 39

attribute :value, Shale::Type::Float

Instance Method Details

#active?Boolean

Returns whether the player is active

Examples:

leader.active? #=> true

Returns:

  • (Boolean)

    true if active



73
74
75
# File 'lib/nba/all_time_leader.rb', line 73

def active?
  is_active
end

#playerPlayer?

Returns the player object

Examples:

leader.player #=> #<NBA::Player>

Returns:

  • (Player, nil)

    the player object



63
64
65
# File 'lib/nba/all_time_leader.rb', line 63

def player
  Players.find(player_id)
end