Sha256: 231b6afb816d2368043712de5bcf994a4e66431f07ed70a86a6b5b617fd97020
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 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 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
backports-1.11.2 | lib/backports/1.9/kernel.rb |
backports-1.11.1 | lib/backports/1.9/kernel.rb |
backports-1.11.0 | lib/backports/1.9/kernel.rb |