Sha256: c2188f2697dbce04e3641a44c4c65a457ca34888581c6f57db743bf4f21cefc2

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Spree
  class DeprecatedConfigurableClass
    def self.new(*_args, &_block)
      @deprecation_proxy ||= DeprecationProxy.new
    end

    def self.method_missing(method_name, *args, &block)
      @deprecation_proxy ||= DeprecationProxy.new
      @deprecation_proxy.send(method_name, args, block)
    end

    def self.respond_to_missing?(_method_name, _include_private = false)
      true
    end

    class DeprecationProxy
      def method_missing(_method_name, *_args, &_block)
        issue_deprecation_warning
        self
      end

      def respond_to_missing?(_method_name, _include_private = false)
        true
      end

      private

      def issue_deprecation_warning
        Spree.deprecator.warn(
          <<-WARNING
            It appears you are using Solidus' Legacy promotion system. This system has been extracted into the
            `solidus_legacy_promotions` gem. Please add the gem to your Gemfile and follow in the instructions in the README.
          WARNING
        )
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_core-4.4.2 app/models/spree/deprecated_configurable_class.rb
solidus_core-4.4.1 app/models/spree/deprecated_configurable_class.rb
solidus_core-4.4.0 app/models/spree/deprecated_configurable_class.rb