Sha256: 04090d6e5af8a6467b84c7f56963817d0d2fd4739c0c95ecc7fa37189ab3a8bd

Contents?: true

Size: 1.67 KB

Versions: 46

Compression:

Stored size: 1.67 KB

Contents

module Kernel
  alias_method :__callee__, :__method__  unless (__callee__ || true rescue false)

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  def define_singleton_method(*args, &block)
    class << self
      self
    end.send(:define_method, *args, &block)
  end unless method_defined? :define_singleton_method

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  def require_relative(relative_feature)
    file = caller.first.split(/:\d/,2).first
    if /\A\((.*)\)/ =~ file # eval, etc.
      raise LoadError, "require_relative is called in #{$1}"
    end
    require File.expand_path(relative_feature, File.dirname(file))
  end unless private_method_defined? :require_relative
  private :require_relative

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  def public_method(meth)
    if respond_to?(meth) && !protected_methods.include?(meth.to_s)
      method(meth)
    else
      raise NameError, "undefined method `#{meth}' for class `#{self.class}'"
    end
  end unless method_defined? :public_method

  # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  def public_send(method, *args, &block)
    if respond_to?(method) && !protected_methods.include?(method.to_s)
      send(method, *args, &block)
    else
      :foo.generate_a_no_method_error_in_preparation_for_method_missing rescue nil
      # otherwise a NameError might be raised when we call method_missing ourselves
      method_missing(method.to_sym, *args, &block)
    end
  end unless method_defined? :public_send
end

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
backports-3.0.3 lib/backports/1.9.1/kernel.rb
backports-3.0.2 lib/backports/1.9.1/kernel.rb
backports-3.0.1 lib/backports/1.9.1/kernel.rb
backports-3.0.0 lib/backports/1.9.1/kernel.rb
backports-2.8.2 lib/backports/1.9.1/kernel.rb
backports-2.8.1 lib/backports/1.9.1/kernel.rb
backports-2.8.0 lib/backports/1.9.1/kernel.rb
backports-2.7.1 lib/backports/1.9.1/kernel.rb
backports-2.7.0 lib/backports/1.9.1/kernel.rb
backports-2.6.7 lib/backports/1.9.1/kernel.rb
backports-2.6.6 lib/backports/1.9.1/kernel.rb
backports-2.6.5 lib/backports/1.9.1/kernel.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/backports-2.6.4/lib/backports/1.9.1/kernel.rb
backports-2.6.4 lib/backports/1.9.1/kernel.rb
backports-2.6.3 lib/backports/1.9.1/kernel.rb
backports-2.6.2 lib/backports/1.9.1/kernel.rb
backports-2.6.1 lib/backports/1.9.1/kernel.rb
backports-2.6.0 lib/backports/1.9.1/kernel.rb
backports-2.5.3 lib/backports/1.9.1/kernel.rb
backports-2.5.2 lib/backports/1.9.1/kernel.rb