lib/mutually_exclusive_collection.rb in rodders-3.0.0 vs lib/mutually_exclusive_collection.rb in rodders-3.0.1
- old
+ new
@@ -41,10 +41,10 @@
# the bookmaker's return rate
# @return [Number] the bookmaker's return rate as a percentage
def bookmakers_return_rate
fs = fractions
- 1 - fs.reduce(:*) / fs.reduce(:+)
+ fs.any? ? 1 - fs.reduce(:*) / fs.reduce(:+) : 0
end
# hash of the odds and what percentage of the total stake should go on each
# @return [Hash<FixedOdds, Number>] hash of odds to percentages
def percentages
\ No newline at end of file