Sha256: deab89782ce655376c7b02951eddd7f5e1a43926b726d65b8f9c4c2f00bae655
Contents?: true
Size: 589 Bytes
Versions: 7
Compression:
Stored size: 589 Bytes
Contents
module Kernel # Send only to public methods. # # class SendExample # private # def foo; end # end # # obj = SendExample.new # # expect NoMethodError do # obj.object_send(:foo) # end # # TODO: object_send needs to change for 1.9. Is it #public_send ? # # 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 __send__(:method_missing, name, *args, &blk) end end end
Version data entries
7 entries across 6 versions & 1 rubygems