Module: SolidusFriendlyPromotions::Conditions::LineItemApplicableOrderCondition

Included in:
OptionValue, Product, Taxon
Defined in:
app/models/concerns/solidus_friendly_promotions/conditions/line_item_applicable_order_condition.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



6
7
8
# File 'app/models/concerns/solidus_friendly_promotions/conditions/line_item_applicable_order_condition.rb', line 6

def self.included(klass)
  klass.preference :line_item_applicable, :boolean, default: true
end

Instance Method Details

#applicable?(promotable) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/concerns/solidus_friendly_promotions/conditions/line_item_applicable_order_condition.rb', line 10

def applicable?(promotable)
  promotable.is_a?(Spree::Order) || preferred_line_item_applicable && promotable.is_a?(Spree::LineItem)
end

#eligible?(promotable) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/models/concerns/solidus_friendly_promotions/conditions/line_item_applicable_order_condition.rb', line 14

def eligible?(promotable)
  send(:"#{promotable.class.name.demodulize.underscore}_eligible?", promotable)
end

#levelObject



18
19
20
# File 'app/models/concerns/solidus_friendly_promotions/conditions/line_item_applicable_order_condition.rb', line 18

def level
  :order
end