class Stattleship::Models::LineUp

Public Instance Methods

dump() click to toggle source
# File lib/stattleship/models/line_up.rb, line 55
def dump
  {
    id: id,
    player_name: player_name,
    inning_half: inning_half,
    position_name: position_name,
    position_abbreviation: position_abbreviation,
    inning: inning,
    batting_order: batting_order,
    lineup_position: lineup_position,
    sequence: sequence,
  }
end
inflielder?() click to toggle source
# File lib/stattleship/models/line_up.rb, line 39
def inflielder?
  position_abbreviation == '1B' ||
  position_abbreviation == '2B' ||
  position_abbreviation == '3B' ||
  position_abbreviation == 'SS' ||
  position_abbreviation == 'C'
end
outflielder?() click to toggle source
# File lib/stattleship/models/line_up.rb, line 47
def outflielder?
  position_abbreviation == 'LF' ||
  position_abbreviation == 'CF' ||
  position_abbreviation == 'RF' ||
  position_abbreviation == 'OF'
end
pitcher?() click to toggle source
# File lib/stattleship/models/line_up.rb, line 34
def pitcher?
  position_abbreviation == 'SP' ||
  position_abbreviation == 'RP'
end
player_label() click to toggle source
# File lib/stattleship/models/line_up.rb, line 12
def player_label
  player.label
end
player_name() click to toggle source
# File lib/stattleship/models/line_up.rb, line 8
def player_name
  player.full_name
end
team_hash() click to toggle source
# File lib/stattleship/models/line_up.rb, line 28
def team_hash
  if team
    team.dump
  end
end
team_name() click to toggle source
# File lib/stattleship/models/line_up.rb, line 16
def team_name
  if team
    team.name
  end
end
team_nickname() click to toggle source
# File lib/stattleship/models/line_up.rb, line 22
def team_nickname
  if team
    team.nickname
  end
end
to_sentence() click to toggle source
# File lib/stattleship/models/line_up.rb, line 4
def to_sentence
  "#{player_label} : #{inning_half} #{inning} inning #{batting_order} batting order #{lineup_position} lineup position"
end