Class: Object
Defined Under Namespace
Modules: InstanceExecHelper
Instance Method Summary
collapse
#andand, #dont, #me
Instance Method Details
#__calling_method__ ⇒ Object
49
50
51
|
# File 'lib/redcar/ruby_extensions.rb', line 49
def __calling_method__
caller[1][/`(.*)'$/, 1].to_sym
end
|
#instance_exec(*args, &block) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/redcar/instance_exec.rb', line 8
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
|
45
46
47
|
# File 'lib/redcar/ruby_extensions.rb', line 45
def meta_class
class << self; self; end
end
|