Sha256: 5a3f735e4fa4197280137ba8a2ae3c7281f290b8a91c6f7c4a6c58cf8f51f6ed

Contents?: true

Size: 1.35 KB

Versions: 26

Compression:

Stored size: 1.35 KB

Contents

unless Method.method_defined? :name
  require 'backports/tools'

  class Method
    attr_accessor :name, :receiver, :owner

    def unbind_with_additional_info
      unbound = unbind_without_additional_info
      unbound.name = name
      unbound.owner = owner
      unbound
    end
    Backports.alias_method_chain self, :unbind, :additional_info
  end

  class UnboundMethod
    attr_accessor :name, :owner

    def bind_with_additional_info(to)
      bound = bind_without_additional_info(to)
      bound.name = name
      bound.owner = owner
      bound.receiver = to
      bound
    end
    Backports.alias_method_chain self, :bind, :additional_info
  end

  module Kernel
    def method_with_additional_info(name)
      bound = method_without_additional_info(name)
      bound.name = name.to_s
      bound.receiver = self
      bound.owner = self.class.ancestors.find{|mod| mod.instance_methods(false).include? bound.name}
      bound
    end
    Backports.alias_method_chain self, :method, :additional_info
  end

  class Module
    def instance_method_with_additional_info(name)
      unbound = instance_method_without_additional_info(name)
      unbound.name = name.to_s
      unbound.owner = ancestors.find{|mod| mod.instance_methods(false).include? unbound.name}
      unbound
    end
    Backports.alias_method_chain self, :instance_method, :additional_info
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
scout_realtime-1.0.5 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-1.0.4 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-1.0.3 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-1.0.3.pre lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-1.0.2 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-1.0.1 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-1.0.0 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-0.5.5 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-0.5.5.pre lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-0.5.4 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
backports-3.6.0 lib/backports/1.8.7/method/name.rb
backports-3.5.0 lib/backports/1.8.7/method/name.rb
backports-3.4.1 lib/backports/1.8.7/method/name.rb
scout_realtime-0.5.3 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-0.5.2 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
scout_realtime-0.5.1 lib/vendor/backports-3.3.5/lib/backports/1.8.7/method/name.rb
backports-3.4.0 lib/backports/1.8.7/method/name.rb
backports-3.3.5 lib/backports/1.8.7/method/name.rb
backports-3.3.4 lib/backports/1.8.7/method/name.rb
backports-3.3.3 lib/backports/1.8.7/method/name.rb