Sha256: c0130466fe54c062eda954fadceee1a9694ea9fb5cb01eb1a4a5ed3adb364399
Contents?: true
Size: 607 Bytes
Versions: 4
Compression:
Stored size: 607 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
4 entries across 4 versions & 1 rubygems