Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CartItem
- include Reloadable
- attr_reader :product, :quantity
- def initialize(product)
- @product = product
- @quantity = 1
- end
- def increment_quantity
- @quantity += 1
- end
- def title
- @product.title
- end
- def price
- @product.price * @quantity
- end
- end
Add Comment
Please, Sign In to add comment