class ROdds::OddStandardizer::ClassFactory

Attributes

format[R]

Public Class Methods

for(params) click to toggle source
# File lib/r_odds/odd_standardizers/class_factory.rb, line 5
def self.for(params)
  new(params).call
end
new(params) click to toggle source
# File lib/r_odds/odd_standardizers/class_factory.rb, line 9
def initialize(params)
  @format = params[:format]
end

Public Instance Methods

call() click to toggle source
# File lib/r_odds/odd_standardizers/class_factory.rb, line 13
def call
  case format
  when :fractional
    ROdds::OddStandardizer::Fractional
  when :american
    ROdds::OddStandardizer::American
  when :implied_probability
    ROdds::OddStandardizer::ImpliedProbability
  when :decimal
    ROdds::OddStandardizer::Decimal
  else
    raise ArgumentError, "No implimented standardizer for odd format :#{format}"
  end
end