Sha256: 6e5ea79bba2dff358a2f8be4c24b797fd079bdaa5dab3bef4c1d46b8f14d9bba
Contents?: true
Size: 382 Bytes
Versions: 17
Compression:
Stored size: 382 Bytes
Contents
module Kernel unless (RUBY_VERSION[0,3] == '1.9') def instance_exec(*args, &block) mname = "__instance_exec_#{Thread.current.object_id.abs}_#{object_id.abs}" Object.class_eval{ define_method(mname, &block) } begin ret = send(mname, *args) ensure Object.class_eval{ undef_method(mname) } rescue nil end ret end end end
Version data entries
17 entries across 16 versions & 3 rubygems