Module: Cordon::Watchlist
- Extended by:
- MethodList
- Defined in:
- lib/cordon/watchlist.rb
Class Method Summary
collapse
Methods included from MethodList
includes?, invoke_method, wrap_method, wrap_methods
Class Method Details
.incursion_report ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/cordon/watchlist.rb', line 17
def incursion_report
report = "=======================\nCordon Incursion Report\n=======================\n EOF\n n = incursions.length\n max_width = n.to_s.length\n\n incursions_by_method = Hash.new { |hash, key| hash[key] = [] }\n incursions.each do |incursion|\n incursions_by_method[incursion.method_descriptor] << incursion\n end\n\n incursions_by_method.to_a.sort.each do |method_descriptor, incursions|\n report << \"\\n\\n\#{method_descriptor}\\n\#{'-' * method_descriptor.length}\"\n incursions.each do |incursion|\n report << \"\\n\" + incursion.backtrace.first.to_s\n end\n end\n report << \"\\n\"\n report\nend\n".strip
|
.incursions ⇒ Object
13
14
15
|
# File 'lib/cordon/watchlist.rb', line 13
def incursions
@incursions ||= []
end
|
.invoke_method(instance, subject, method, *args, &b) ⇒ Object
8
9
10
11
|
# File 'lib/cordon/watchlist.rb', line 8
def invoke_method(instance, subject, method, *args, &b)
record_incursion(subject, method, args)
super
end
|