Module: Kernel
- Defined in:
- lib/active_rdf/instance_exec.rb
Instance Method Summary collapse
-
#instance_exec(*args, &block) ⇒ Object
Like instace_eval but allows parameters to be passed.
Instance Method Details
#instance_exec(*args, &block) ⇒ Object
Like instace_eval but allows parameters to be passed.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/active_rdf/instance_exec.rb', line 3 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 |