Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.3.8) is shown here.
instance_exec(*args, &block)
public
Show source
def instance_exec(*args, &block)
begin
old_critical, Thread.critical = Thread.critical, true
n = 0
n += 1 while respond_to?(method_name = "__instance_exec#{n}")
InstanceExecMethods.module_eval { define_method(method_name, &block) }
ensure
Thread.critical = old_critical
end
begin
send(method_name, *args)
ensure
InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
end
end