Class: Spree::Promotion::Rules::ItemTotal
- Inherits:
-
Spree::PromotionRule
- Object
- ActiveRecord::Base
- Spree::PromotionRule
- Spree::Promotion::Rules::ItemTotal
- Defined in:
- app/models/spree/promotion/rules/item_total.rb
Constant Summary collapse
- OPERATORS =
['gt', 'gte']
Instance Method Summary collapse
Methods inherited from Spree::PromotionRule
Instance Method Details
#applicable?(promotable) ⇒ Boolean
12 13 14 |
# File 'app/models/spree/promotion/rules/item_total.rb', line 12 def applicable?(promotable) promotable.is_a?(Spree::Order) end |
#eligible?(order, options = {}) ⇒ Boolean
16 17 18 19 |
# File 'app/models/spree/promotion/rules/item_total.rb', line 16 def eligible?(order, = {}) item_total = order.item_total item_total.send(preferred_operator == 'gte' ? :>= : :>, BigDecimal.new(preferred_amount.to_s)) end |