Module: SolidusPromotions::Conditions::LineItemLevelCondition

Included in:
LineItemOptionValue, LineItemProduct, LineItemTaxon
Defined in:
app/models/concerns/solidus_promotions/conditions/line_item_level_condition.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/concerns/solidus_promotions/conditions/line_item_level_condition.rb', line 6

def self.included(base)
  def base.method_added(method)
    if method == :eligible?
      Spree.deprecator.warn <<~MSG
        Defining `eligible?` on a promotion along with including the `LineItemLevelCondition` module is deprecated.
        Rename `eligible?` to `line_item_eligible?` and stop including the `LineItemLevelCondition` module.
      MSG
      define_method(:applicable?) do |promotable|
        promotable.is_a?(Spree::LineItem)
      end
    end

    super
  end
end

Instance Method Details

#levelObject



22
23
24
# File 'app/models/concerns/solidus_promotions/conditions/line_item_level_condition.rb', line 22

def level
  :line_item
end