class Stattleship::Models::Player

Public Instance Methods

active?() click to toggle source
# File lib/stattleship/models/player.rb, line 4
def active?
  active
end
dump() click to toggle source
# File lib/stattleship/models/player.rb, line 58
def dump
  {
    active: active?,
    birth_date: birth_date,
    first_name: first_name,
    handedness: handedness,
    height: height,
    humanized_salary: humanized_salary,
    inflielder: inflielder?,
    label: label,
    last_name: last_name,
    name: name,
    outflielder: outflielder?,
    pitcher: pitcher?,
    position_abbreviation: position_abbreviation,
    position_name: position_name,
    salary: salary,
    salary_currency: salary_currency,
    school: school,
    slug: slug,
    sport: sport,
    team_name: team_name,
    team_nickname: team_nickname,
    team: team_hash,
    unit_of_height: unit_of_height,
    unit_of_weight: unit_of_weight,
    weight: weight,
    years_of_experience: years_of_experience,
    city: city,
    state: state,
    country: country,
    draft_season: draft_season,
    draft_round: draft_round,
    draft_overall_pick: draft_overall_pick,
    draft_team_name: draft_team_name,
  }
end
full_name() click to toggle source
# File lib/stattleship/models/player.rb, line 8
def full_name
  if name == ''
    "#{first_name} #{last_name}"
  else
    name
  end
end
inflielder?() click to toggle source
# File lib/stattleship/models/player.rb, line 43
def inflielder?
  position_abbreviation == '1B' ||
  position_abbreviation == '2B' ||
  position_abbreviation == '3B' ||
  position_abbreviation == 'SS' ||
  position_abbreviation == 'C'
end
label() click to toggle source
# File lib/stattleship/models/player.rb, line 16
def label
  "#{full_name} (#{position_abbreviation}) - #{team_nickname}"
end
outflielder?() click to toggle source
# File lib/stattleship/models/player.rb, line 51
def outflielder?
  position_abbreviation == 'LF' ||
  position_abbreviation == 'CF' ||
  position_abbreviation == 'RF' ||
  position_abbreviation == 'OF'
end
pitcher?() click to toggle source
# File lib/stattleship/models/player.rb, line 38
def pitcher?
  position_abbreviation == 'SP' ||
  position_abbreviation == 'RP'
end
team_hash() click to toggle source
# File lib/stattleship/models/player.rb, line 32
def team_hash
  if team
    team.dump
  end
end
team_name() click to toggle source
# File lib/stattleship/models/player.rb, line 20
def team_name
  if team
    team.name
  end
end
team_nickname() click to toggle source
# File lib/stattleship/models/player.rb, line 26
def team_nickname
  if team
    team.nickname
  end
end