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
133 134 135 136 137 |
# File 'lib/rjr/common.rb', line 133 def eigenclass class << self self end end |
#instance_exec(*args, &block) ⇒ Object
Execute the specified block in the scope of the local object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/rjr/common.rb', line 150 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 |