Class: Object
Overview
Defined Under Namespace
Modules: InstanceExecHelper
Instance Method Summary collapse
- #eigenclass ⇒ Object
-
#instance_exec(*args, &block) ⇒ Object
Execute the specified block in the scope of the local object.
Instance Method Details
#eigenclass ⇒ Object
143 144 145 146 147 |
# File 'lib/rjr/common.rb', line 143 def eigenclass class << self self end end |
#instance_exec(*args, &block) ⇒ Object
Execute the specified block in the scope of the local object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/rjr/common.rb', line 160 def instance_exec(*args, &block) begin old_critical, Thread.critical = Thread.critical, true n = 0 n += 1 while respond_to?(mname="__instance_exec#{n}") InstanceExecHelper.module_eval{ define_method(mname, &block) } ensure Thread.critical = old_critical end begin ret = send(mname, *args) ensure InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil end ret end |