Sha256: 74dc64ec937ae527df92fa570e8292b6d1889868670680343a73502eb899aa65

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true
Money.class_eval do
  ACTIVE_SUPPORT_DEFINED = defined?(ActiveSupport)

  def self.active_support_deprecator
    @active_support_deprecator ||= begin
      next_major_version = Money::VERSION.split(".").first.to_i + 1
      ActiveSupport::Deprecation.new("#{next_major_version}.0.0", "Shopify/Money")
    end
  end

  def self.deprecate(message)
    if ACTIVE_SUPPORT_DEFINED
      external_callstack = caller_locations.reject do |location|
        location.to_s.include?('gems/shopify-money')
      end
      active_support_deprecator.warn("[Shopify/Money] #{message}\n", external_callstack)
    else
      Kernel.warn("DEPRECATION WARNING: [Shopify/Money] #{message}\n")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
shopify-money-3.0.0 lib/money/deprecations.rb
shopify-money-2.2.2 lib/money/deprecations.rb
shopify-money-2.2.1 lib/money/deprecations.rb
shopify-money-2.2.0 lib/money/deprecations.rb
shopify-money-2.0.0 lib/money/deprecations.rb
shopify-money-1.3.0 lib/money/deprecations.rb