class Bagel::Tennis::Stats::Stat
Public Class Methods
new(points)
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 5 def initialize(points) @points = points calculate end
Public Instance Methods
name()
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 10 def name raise_not_implemented_error(self.class, __method__) end
superior()
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 18 def superior raise_not_implemented_error(self.class, __method__) end
values()
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 14 def values raise_not_implemented_error(self.class, __method__) end
Private Instance Methods
calculate()
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 28 def calculate raise_not_implemented_error(self.class, __method__) end
label(total, won, percentage)
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 36 def label(total, won, percentage) "#{won}/#{total} (#{percentage}%)" end
percentage(total, won)
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 32 def percentage(total, won) (won / total.to_f * 100).round rescue 0 end
raise_not_implemented_error(klass, method)
click to toggle source
# File lib/bagel/tennis/stats/stat.rb, line 24 def raise_not_implemented_error(klass, method) raise NotImplementedError, "#{klass} has not implemented method '#{method}'" end