Sha256: 1b39ddcb1de1520c3c17b63dccb7ee4eefb34a8fe24e03b29d9ebc423cb113f4
Contents?: true
Size: 1.3 KB
Versions: 17
Compression:
Stored size: 1.3 KB
Contents
# Mixin this module into any classes that act as an order_total. # # You need to overwrite the price, name and description methods # module ActiveCart module OrderTotal # Returns a boolean depending if the order total is active in this particular cart # # @order_total.active? # => true # def active? @active || false end # Make a particular order_total active # # @order_total.active = true # @order_total.active? # => true # # @order_total.active = false # @order_total.active? # => falese # def active=(active) @active = active end # Returns the adjustment caused by this order_total object. Takes a cart object as a parameter, allowing the object to interrogate the items in the cart. # # This must be overriden in the mixee class, otherwise it will throw a NotImplementedError # # @order.price(@cart) => 2 # def price(cart) raise NotImplementedError end # Returns the friendly name of the order total. Can be used for display (Such as on an invoices etc) # # This must be overriden in the mixee class, otherwise it will throw a NotImplementedError # # @order.name # => 'My awesome order total class' # def name raise NotImplementedError end end end
Version data entries
17 entries across 17 versions & 2 rubygems