Class: SolidusFriendlyPromotions::ItemDiscount
- Inherits:
-
Object
- Object
- SolidusFriendlyPromotions::ItemDiscount
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/solidus_friendly_promotions/item_discount.rb
Overview
Simple object used to hold discount data for an item.
This generic object will hold the amount of discount that should be applied to an item.
Instance Attribute Summary collapse
-
#amount ⇒ BigDecimal
the amount of discount applied to the item.
-
#item ⇒ Object
Returns the value of attribute item.
-
#label ⇒ String
information about the discount.
-
#source ⇒ ApplicationRecord
will be used as the source for adjustments.
-
#the ⇒ Spree::LineItem, Spree::Shipment
readonly
item to be discounted.
Instance Method Summary collapse
Instance Attribute Details
#amount ⇒ BigDecimal
the amount of discount applied to the item
13 14 15 |
# File 'app/models/solidus_friendly_promotions/item_discount.rb', line 13 def amount @amount end |
#item ⇒ Object
Returns the value of attribute item.
15 16 17 |
# File 'app/models/solidus_friendly_promotions/item_discount.rb', line 15 def item @item end |
#label ⇒ String
information about the discount
13 14 15 |
# File 'app/models/solidus_friendly_promotions/item_discount.rb', line 13 def label @label end |
#source ⇒ ApplicationRecord
will be used as the source for adjustments
13 14 15 |
# File 'app/models/solidus_friendly_promotions/item_discount.rb', line 13 def source @source end |
#the ⇒ Spree::LineItem, Spree::Shipment (readonly)
item to be discounted.
13 14 15 |
# File 'app/models/solidus_friendly_promotions/item_discount.rb', line 13 def the @the end |
Instance Method Details
#==(other) ⇒ Object
17 18 19 |
# File 'app/models/solidus_friendly_promotions/item_discount.rb', line 17 def ==(other) item == other.item && label == other.label && source == other.source && amount == other.amount end |