Sha256: 84f0ab27ce29c8b05c65cc321e7e483cdf35431a8b7aeaa33627a24131506098
Contents?: true
Size: 608 Bytes
Versions: 6
Compression:
Stored size: 608 Bytes
Contents
module Kernel # Send only to public methods. # # class X # private # def foo; end # end # # X.new.object_send(:foo) # => NoMethodError: private method `foo' called for #<X:0xb7ac6ba8> # # TODO: object_send needs to change for 1.9. # # CREDIT: Trans #-- # Which implementation is faster? #++ def object_send(name,*args,&blk) #instance_eval "self.#{name}(*args)" if respond_to?(name) send(name,*args,&blk) else #if respond_to?(:method_missing) method_missing(name,*args,&blk) #else # raise NoMethodError end end end
Version data entries
6 entries across 6 versions & 2 rubygems