class Stattleship::TotalPlayerStat

Public Class Methods

fetch(path:, params:) click to toggle source
Calls superclass method Stattleship::Endpoint::fetch
# File lib/stattleship/total_player_stat.rb, line 21
def self.fetch(path:, params:)
  super.first
end

Public Instance Methods

format_stat(value) click to toggle source
# File lib/stattleship/total_player_stat.rb, line 17
def format_stat(value)
  StatFormatter.stat(stat_name: stat, value: total)
end
lowercase_stat() click to toggle source
# File lib/stattleship/total_player_stat.rb, line 11
def lowercase_stat
  if humanized_stat
    humanized_stat.downcase
  end
end
populate() click to toggle source
# File lib/stattleship/total_player_stat.rb, line 25
def populate
  populate_players(total_player_stat)
  populate_player_teams(total_player_stat)
  populate_season(total_player_stat)
  total_player_stat
end
to_sentence() click to toggle source
# File lib/stattleship/total_player_stat.rb, line 3
def to_sentence
  if season_name.nil?
    "#{player.name} has #{format_stat(total)} #{lowercase_stat}"
  else
    "#{player.name} had #{format_stat(total)} #{lowercase_stat} in the #{season_name} season"
  end
end