class Stattleship::Models::TeamOutcomeStreak

Public Instance Methods

current?() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 4
def current?
  current
end
ended_on_short_date() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 64
def ended_on_short_date
  ended_on.to_datetime.strftime('%b %d')
end
league_abbreviation() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 12
def league_abbreviation
  league.abbreviation
end
league_name() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 8
def league_name
  league.name
end
loss?() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 52
def loss?
  outcome == 'loss'
end
outcome_participle() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 44
def outcome_participle
  if win?
    'winning'
  else
    'losing'
  end
end
started_on_short_date() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 60
def started_on_short_date
   started_on.to_datetime.strftime('%b %d')
end
team_full_name() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 28
def team_full_name
  team.full_name
end
team_location() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 16
def team_location
  team.location
end
team_name() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 20
def team_name
  team.name
end
team_nickname() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 24
def team_nickname
  team.nickname
end
to_rank() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 40
def to_rank
  "#{team_full_name} #{rank.ordinalize} streak of the season is a #{streak_length} game #{outcome} streak between #{started_on_short_date} and #{ended_on_short_date}."
end
to_sentence() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 32
def to_sentence
  if current
    "#{team_full_name} are currently on a #{streak_length} game #{outcome_participle} streak starting #{started_on_short_date}"
  else
    "#{team_full_name} had a #{streak_length} game #{outcome_participle} streak between #{started_on_short_date} and #{ended_on_short_date}"
  end
end
win?() click to toggle source
# File lib/stattleship/models/team_outcome_streak.rb, line 56
def win?
  outcome == 'win'
end