class Bet::Calc

Constants

DEFAULT_OPTS
WIN_PLACE_LOSS_INTEGER

Attributes

outlay[RW]
profit[RW]
returns[RW]

Public Class Methods

new(bet_type, *args) click to toggle source
# File lib/bet/calc.rb, line 17
def initialize(bet_type, *args)
  @returns, @profit, @outlay = self.class.send(bet_type, *args).values
end

Private Class Methods

c(stake, price) click to toggle source
# File lib/bet/calc.rb, line 27
def c(stake, price)
  stake * price
end
parse_opts(opts_or_prices) click to toggle source
# File lib/bet/calc.rb, line 35
def parse_opts(opts_or_prices)
  opts_or_prices.is_a?(Hash) ? DEFAULT_OPTS.merge(opts_or_prices) : DEFAULT_OPTS
end
parse_prices(prices) click to toggle source
# File lib/bet/calc.rb, line 31
def parse_prices(prices)
  Array(prices)
end
win_place_lose?(v) click to toggle source
# File lib/bet/calc.rb, line 23
def win_place_lose?(v)
  v.is_a?(Fixnum) ? WIN_PLACE_LOSS_INTEGER[v] : v
end