Module: ActiveCart::OrderTotal
- Defined in:
- lib/active_cart/order_total.rb
Instance Method Summary collapse
-
#active=(active) ⇒ Object
Make a particular order_total active.
-
#active? ⇒ Boolean
Returns a boolean depending if the order total is active in this particular cart.
-
#name ⇒ Object
Returns the friendly name of the order total.
-
#price(cart) ⇒ Object
Returns the adjustment caused by this order_total object.
Instance Method Details
#active=(active) ⇒ Object
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 |
#active? ⇒ Boolean
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 |
#name ⇒ Object
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 |
#price(cart) ⇒ Object
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 |