24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/vhost/site_scoped_model_extensions.rb', line 24
def clear_callbacks_by_calling_method_name(kind, calling_method_name)
calling_method_name = calling_method_name.to_s
callback_chain = eval("@#{kind.to_s}_callbacks")
unless callback_chain.nil?
callback_chain.reject! do |callback|
method = callback.method
if method.is_a?(Proc)
current_calling_method_name = eval("caller[0] =~ /`([^']*)'/ and $1", method.binding).to_s rescue nil
current_calling_method_name == calling_method_name
else
false
end
end
end
end
|