based on Bounded Spec InstanceExec (Mauricio Fernandez) eigenclass.org/hiki/bounded+space+instance_exec
uses singleton_class of matcher instead of global InstanceExecHelper module
this keeps it scoped to this class only, which is the only place we need it
only necessary for ruby 1.8.6
# File lib/spec/extensions/instance_exec.rb, line 12 12: def instance_exec(*args, &block) 13: singleton_class = (class << self; self; end) 14: begin 15: orig_critical, Thread.critical = Thread.critical, true 16: n = 0 17: n += 1 while respond_to?(method_name="__instance_exec#{n}") 18: singleton_class.module_eval{ define_method(:__instance_exec, &block) } 19: ensure 20: Thread.critical = orig_critical 21: end 22: begin 23: return send(:__instance_exec, *args) 24: ensure 25: singleton_class.module_eval{ remove_method(:__instance_exec) } rescue nil 26: end 27: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.