Class: MLB::DerbyBatter

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

Overview

Represents a batter’s derby performance

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#full_nameString

Returns the player’s full name

Examples:

batter.full_name #=> "Shohei Ohtani"

Returns:

  • (String)

    the full name



75
# File 'lib/mlb/home_run_derby.rb', line 75

attribute :full_name, Shale::Type::String

#hitsArray<DerbyHomeRun>

Returns the home run details

Examples:

batter.hits #=> [#<MLB::DerbyHomeRun>, ...]

Returns:



123
# File 'lib/mlb/home_run_derby.rb', line 123

attribute :hits, DerbyHomeRun, collection: true

#home_runsInteger

Returns the number of home runs

Examples:

batter.home_runs #=> 24

Returns:

  • (Integer)

    the home run count



99
# File 'lib/mlb/home_run_derby.rb', line 99

attribute :home_runs, Shale::Type::Integer

#idInteger

Returns the player ID

Examples:

batter.id #=> 660271

Returns:

  • (Integer)

    the player ID



67
# File 'lib/mlb/home_run_derby.rb', line 67

attribute :id, Shale::Type::Integer

#is_bonusBoolean

Returns whether batter earned bonus time

Examples:

batter.bonus? #=> true

Returns:

  • (Boolean)

    whether bonus earned



115
# File 'lib/mlb/home_run_derby.rb', line 115

attribute :is_bonus, Shale::Type::Boolean

#is_winnerBoolean

Returns whether this batter won their matchup

Examples:

batter.winner? #=> true

Returns:

  • (Boolean)

    whether winner



107
# File 'lib/mlb/home_run_derby.rb', line 107

attribute :is_winner, Shale::Type::Boolean

Returns the API link to the player

Examples:

batter.link #=> "/api/v1/people/660271"

Returns:

  • (String)

    the link



83
# File 'lib/mlb/home_run_derby.rb', line 83

attribute :link, Shale::Type::String

#seedInteger

Returns the batter’s seed

Examples:

batter.seed #=> 1

Returns:

  • (Integer)

    the seed



91
# File 'lib/mlb/home_run_derby.rb', line 91

attribute :seed, Shale::Type::Integer

Instance Method Details

#bonus?Boolean

Returns whether this batter earned bonus time

Examples:

batter.bonus? #=> true

Returns:

  • (Boolean)

    whether bonus earned



141
142
143
# File 'lib/mlb/home_run_derby.rb', line 141

def bonus?
  is_bonus
end

#winner?Boolean

Returns whether this batter won their matchup

Examples:

batter.winner? #=> true

Returns:

  • (Boolean)

    whether winner



131
132
133
# File 'lib/mlb/home_run_derby.rb', line 131

def winner?
  is_winner
end