Class: Spree::Promotion::Rules::UserRole Private
- Inherits:
-
Spree::PromotionRule
- Object
- ActiveRecord::Base
- Base
- Spree::PromotionRule
- Spree::Promotion::Rules::UserRole
- Defined in:
- app/models/spree/promotion/rules/user_role.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- MATCH_POLICIES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w(any all)
Instance Method Summary collapse
Methods inherited from Spree::PromotionRule
#actionable?, #eligibility_errors, for
Methods inherited from Base
display_includes, #initialize_preference_defaults, page, preference
Methods included from Spree::Preferences::Preferable
#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#applicable?(promotable) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'app/models/spree/promotion/rules/user_role.rb', line 10 def applicable?(promotable) promotable.is_a?(Spree::Order) end |
#eligible?(order, _options = {}) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 21 |
# File 'app/models/spree/promotion/rules/user_role.rb', line 14 def eligible?(order, = {}) return false unless order.user if all_match_policy? match_all_roles?(order) else match_any_roles?(order) end end |