Sha256: d894c0332486a3aa0990d36ef8f62394264ad7716ed6ae648d559ac5cbd91c7c
Contents?: true
Size: 791 Bytes
Versions: 20
Compression:
Stored size: 791 Bytes
Contents
# Mixin this module into the class you want to act as an item # module ActiveCart # module Item # A unique id for the item. The Mixee needs to implement this or a NotImplementedError will be thrown # def id raise NotImplementedError end # A display name for the item. The Mixee needs to implement this or a NotImplementedError will be thrown # def name raise NotImplementedError end # Returns the quantity of this item in the context of a cart # def quantity @quantity || 0 end # Set the quantity of this item in the context of a cart # def quantity=(quantity) @quantity = quantity end # Returns the price of this item # def price raise NotImplementedError end end end
Version data entries
20 entries across 20 versions & 2 rubygems