Class: Stattleship::Leader

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/stattleship/stat_leaders.rb

Instance Method Summary collapse

Instance Method Details

#format_stat(value) ⇒ Object


13
14
15
# File 'lib/stattleship/stat_leaders.rb', line 13

def format_stat(value)
  StatFormatter.stat(stat_name: stat_name, value: stat)
end

#lowercase_statObject


17
18
19
20
21
# File 'lib/stattleship/stat_leaders.rb', line 17

def lowercase_stat
  if humanized_stat
    humanized_stat.downcase
  end
end

#player_nameObject


3
4
5
6
7
# File 'lib/stattleship/stat_leaders.rb', line 3

def player_name
  if player
    player.name
  end
end

#to_sentenceObject


9
10
11
# File 'lib/stattleship/stat_leaders.rb', line 9

def to_sentence
  "#{player.name} is in #{place.ordinalize} place with #{format_stat(stat)} #{lowercase_stat}"
end