Module: ActiveCart::OrderTotal
- Defined in:
- lib/active_cart/order_total.rb
Instance Method Summary (collapse)
-
- (Object) active=(active)
Make a particular order_total active.
-
- (Boolean) active?
Returns a boolean depending if the order total is active in this particular cart.
-
- (Object) name
Returns the friendly name of the order total.
-
- (Object) price(cart)
Returns the adjustment caused by this order_total object.
Instance Method Details
- (Object) active=(active)
Make a particular order_total active
@order_total.active = true
@order_total.active? # => true
@order_total.active = false
@order_total.active? # => falese
24 25 26 |
# File 'lib/active_cart/order_total.rb', line 24 def active=(active) @active = active end |
- (Boolean) active?
Returns a boolean depending if the order total is active in this particular cart
@order_total.active? # => true
12 13 14 |
# File 'lib/active_cart/order_total.rb', line 12 def active? @active || false end |
- (Object) name
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'
44 45 46 |
# File 'lib/active_cart/order_total.rb', line 44 def name raise NotImplementedError end |
- (Object) price(cart)
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
34 35 36 |
# File 'lib/active_cart/order_total.rb', line 34 def price(cart) raise NotImplementedError end |