Class: Spree::ShippingCalculator

Inherits:
Calculator
  • Object
show all
Defined in:
app/models/spree/shipping_calculator.rb

Instance Method Summary collapse

Methods inherited from Calculator

calculators, description, #description, register, #to_s

Instance Method Details

#available?(package) ⇒ Boolean

Returns:

  • (Boolean)

13
14
15
# File 'app/models/spree/shipping_calculator.rb', line 13

def available?(package)
  true
end

#compute(package_or_shipment) ⇒ Object


3
4
5
6
7
# File 'app/models/spree/shipping_calculator.rb', line 3

def compute(package_or_shipment)
  package = package_or_shipment.respond_to?(:to_package) ?
              package_or_shipment.to_package : package_or_shipment
  compute_package package
end

#compute_package(package) ⇒ Object

Raises:

  • (NotImplementedError)

9
10
11
# File 'app/models/spree/shipping_calculator.rb', line 9

def compute_package(package)
  raise(NotImplementedError, 'please use concrete calculator')
end