Class: MLB::StatValues

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/stat_values.rb

Overview

Represents offensive stat values for players or teams

Examples:

Access player stats

player_stat.stat.games_played #=> 162
player_stat.stat.home_runs #=> 54

Access team stats

team_stat.stat.runs #=> 829
team_stat.stat.ops #=> ".781"

Instance Attribute Summary collapse

Instance Attribute Details

#at_batsInteger

Returns the number of at bats

Examples:

stat.at_bats #=> 570

Returns:

  • (Integer)

    at bats



92
# File 'lib/mlb/stat_values.rb', line 92

attribute :at_bats, Shale::Type::Integer

#avgString

Returns the batting average

Examples:

stat.avg #=> ".311"

Returns:

  • (String)

    batting average



84
# File 'lib/mlb/stat_values.rb', line 84

attribute :avg, Shale::Type::String

#base_on_ballsInteger

Returns the number of walks

Examples:

stat.base_on_balls #=> 111

Returns:

  • (Integer)

    walks



68
# File 'lib/mlb/stat_values.rb', line 68

attribute :base_on_balls, Shale::Type::Integer

#doublesInteger

Returns the number of doubles

Examples:

stat.doubles #=> 28

Returns:

  • (Integer)

    doubles



36
# File 'lib/mlb/stat_values.rb', line 36

attribute :doubles, Shale::Type::Integer

#games_playedInteger

Returns the number of games played

Examples:

stat.games_played #=> 162

Returns:

  • (Integer)

    games played



20
# File 'lib/mlb/stat_values.rb', line 20

attribute :games_played, Shale::Type::Integer

#hitsInteger

Returns the number of hits

Examples:

stat.hits #=> 177

Returns:

  • (Integer)

    hits



76
# File 'lib/mlb/stat_values.rb', line 76

attribute :hits, Shale::Type::Integer

#home_runsInteger

Returns the number of home runs

Examples:

stat.home_runs #=> 54

Returns:

  • (Integer)

    home runs



52
# File 'lib/mlb/stat_values.rb', line 52

attribute :home_runs, Shale::Type::Integer

#obpString

Returns the on-base percentage

Examples:

stat.obp #=> ".425"

Returns:

  • (String)

    on-base percentage



100
# File 'lib/mlb/stat_values.rb', line 100

attribute :obp, Shale::Type::String

#opsString

Returns the on-base plus slugging

Examples:

stat.ops #=> "1.111"

Returns:

  • (String)

    on-base plus slugging



116
# File 'lib/mlb/stat_values.rb', line 116

attribute :ops, Shale::Type::String

#rbiInteger

Returns the number of runs batted in

Examples:

stat.rbi #=> 130

Returns:

  • (Integer)

    runs batted in



132
# File 'lib/mlb/stat_values.rb', line 132

attribute :rbi, Shale::Type::Integer

#runsInteger

Returns the number of runs scored

Examples:

stat.runs #=> 122

Returns:

  • (Integer)

    runs scored



28
# File 'lib/mlb/stat_values.rb', line 28

attribute :runs, Shale::Type::Integer

#slgString

Returns the slugging percentage

Examples:

stat.slg #=> ".686"

Returns:

  • (String)

    slugging percentage



108
# File 'lib/mlb/stat_values.rb', line 108

attribute :slg, Shale::Type::String

#stolen_basesInteger

Returns the number of stolen bases

Examples:

stat.stolen_bases #=> 9

Returns:

  • (Integer)

    stolen bases



124
# File 'lib/mlb/stat_values.rb', line 124

attribute :stolen_bases, Shale::Type::Integer

#strike_outsInteger

Returns the number of strikeouts

Examples:

stat.strike_outs #=> 175

Returns:

  • (Integer)

    strikeouts



60
# File 'lib/mlb/stat_values.rb', line 60

attribute :strike_outs, Shale::Type::Integer

#triplesInteger

Returns the number of triples

Examples:

stat.triples #=> 3

Returns:

  • (Integer)

    triples



44
# File 'lib/mlb/stat_values.rb', line 44

attribute :triples, Shale::Type::Integer