Class: Spree::Promotion::Rules::Store
- Inherits:
-
PromotionRule
- Object
- PromotionRule
- Spree::Promotion::Rules::Store
- Defined in:
- app/models/spree/promotion/rules/store.rb
Instance Method Summary collapse
- #applicable?(promotable) ⇒ Boolean
- #eligible?(order, options = {}) ⇒ Boolean
- #store_ids_string ⇒ Object
- #store_ids_string=(s) ⇒ Object
Instance Method Details
#applicable?(promotable) ⇒ Boolean
7 8 9 |
# File 'app/models/spree/promotion/rules/store.rb', line 7 def applicable?(promotable) promotable.is_a?(Spree::Order) end |
#eligible?(order, options = {}) ⇒ Boolean
11 12 13 |
# File 'app/models/spree/promotion/rules/store.rb', line 11 def eligible?(order, = {}) stores.none? or stores.include?(order.store) end |
#store_ids_string ⇒ Object
19 20 21 |
# File 'app/models/spree/promotion/rules/store.rb', line 19 def store_ids_string store_ids.join(',') end |
#store_ids_string=(s) ⇒ Object
23 24 25 |
# File 'app/models/spree/promotion/rules/store.rb', line 23 def store_ids_string=(s) self.store_ids = s.to_s.split(',').map(&:strip) end |