class Stall::Shipping::Config

Public Instance Methods

configure() { |self| ... } click to toggle source
# File lib/stall/shipping/config.rb, line 14
def configure
  yield self
end
method_missing(name, *args) { |calculator| ... } click to toggle source
Calls superclass method
# File lib/stall/shipping/config.rb, line 18
def method_missing(name, *args)
  if (calculator = Stall::Shipping::Calculator.for(name))
    if block_given?
      yield calculator
    else
      calculator
    end
  else
    super
  end
end
register_calculator(name, calculator) click to toggle source

This mehtod allows for registering an in-app calculator that can be auto loaded without having to explicitly require it

Use a string representing the calculator name if the target class is auto-loaded by Rails

# File lib/stall/shipping/config.rb, line 10
def register_calculator(name, calculator)
  Stall::Shipping.calculators[name] = calculator
end