Class: Stattleship::Stat

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

Instance Method Summary collapse

Instance Method Details

#nameObject


3
4
5
# File 'lib/stattleship/stats.rb', line 3

def name
  subject.name
end

#subjectObject


7
8
9
# File 'lib/stattleship/stats.rb', line 7

def subject
  player || team
end

#to_sentenceObject


11
12
13
# File 'lib/stattleship/stats.rb', line 11

def to_sentence
  "#{name} had #{StatFormatter.stat(stat_name: stat_name, value: stat) || 'no'} #{stat_name} on #{game.name}"
end