class Stattleship::BaseballGameLog

Public Instance Methods

stats() click to toggle source
# File lib/stattleship/baseball_game_logs.rb, line 3
def stats
  if player.pitcher?
    [
      "#{pitcher_strikeouts.to_i} K",
      "#{pitches_thrown.to_i} thrown",
      "#{strikes_thrown.to_i} K thrown",
      "#{pitcher_runs.to_i} R"
    ]
  else
    [
      "#{hits.to_i} H",
      "#{runs.to_i} R",
      "#{runs_batted_in.to_i} RBI",
      "#{fielding_errors.to_i} E"
    ]
  end
end
to_sentence() click to toggle source
# File lib/stattleship/baseball_game_logs.rb, line 21
def to_sentence
  "#{player_name} #{stats.join(', ')} (#{game.name})"
end