Sha256: 6a2a99151b8b533ac2cf6163f387617dc68f944f6e37e89e8443757f1608f7a4

Contents?: true

Size: 1 KB

Versions: 23

Compression:

Stored size: 1 KB

Contents

require "active_support/core_ext/kernel/singleton_class"
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

23 entries across 23 versions & 3 rubygems

Version Path
activesupport-5.1.7 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.7.rc1 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.6.2 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.6.1 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.6 lib/active_support/deprecation/instance_delegator.rb
tdiary-5.0.8 vendor/bundle/gems/activesupport-5.1.5/lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.5 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.5.rc1 lib/active_support/deprecation/instance_delegator.rb
pract6-0.1.0 .gem/ruby/2.3.0/gems/activesupport-5.1.4/lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.4 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.4.rc1 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.3 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.3.rc3 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.3.rc2 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.3.rc1 lib/active_support/deprecation/instance_delegator.rb
tdiary-5.0.5 vendor/bundle/gems/activesupport-5.1.2/lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.2 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.2.rc1 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.1 lib/active_support/deprecation/instance_delegator.rb
activesupport-5.1.0 lib/active_support/deprecation/instance_delegator.rb