Sha256: 79bccc085fd73fa073e4cae93c8f45ca6bd427fffadae3bd36be60eb80bcf18f

Contents?: true

Size: 998 Bytes

Versions: 88

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

require "active_support/core_ext/module/delegation"

module ActiveSupport
  class Deprecation
    module InstanceDelegator # :nodoc:
      def self.included(base)
        base.extend(ClassMethods)
        base.singleton_class.prepend(OverrideDelegators)
        base.public_class_method :new
      end

      module ClassMethods # :nodoc:
        def include(included_module)
          included_module.instance_methods.each { |m| method_added(m) }
          super
        end

        def method_added(method_name)
          singleton_class.delegate(method_name, to: :instance)
        end
      end

      module OverrideDelegators # :nodoc:
        def warn(message = nil, callstack = nil)
          callstack ||= caller_locations(2)
          super
        end

        def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
          caller_backtrace ||= caller_locations(2)
          super
        end
      end
    end
  end
end

Version data entries

88 entries across 83 versions & 13 rubygems

Version Path
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/deprecation/instance_delegator.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/activesupport-6.1.4.4/lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.1 lib/active_support/deprecation/instance_delegator.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.4/lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.0 lib/active_support/deprecation/instance_delegator.rb
activesupport-6.1.4.4 lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.0.rc3 lib/active_support/deprecation/instance_delegator.rb
activesupport-6.1.4.3 lib/active_support/deprecation/instance_delegator.rb
activesupport-6.1.4.2 lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.0.rc2 lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.0.rc1 lib/active_support/deprecation/instance_delegator.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/deprecation/instance_delegator.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.0.alpha2 lib/active_support/deprecation/instance_delegator.rb
activesupport-7.0.0.alpha1 lib/active_support/deprecation/instance_delegator.rb
activesupport-6.1.4.1 lib/active_support/deprecation/instance_delegator.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.4/lib/active_support/deprecation/instance_delegator.rb
activesupport-6.1.4 lib/active_support/deprecation/instance_delegator.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/deprecation/instance_delegator.rb
activesupport-6.1.3.2 lib/active_support/deprecation/instance_delegator.rb