| Module | Aquarium::Aspects::ExclusionHandler |
| In: |
lib/aquarium/aspects/exclusion_handler.rb
|
Defines methods shared by several classes that take :exclude_* arguments.
# File lib/aquarium/aspects/exclusion_handler.rb, line 28
28: def all_excluded_pointcuts
29: @all_excluded_pointcuts ||= @specification[:exclude_pointcuts]
30: end
Using @specification[:exclude_join_points].include?(jp) doesn‘t always work correctly (it probably uses equal?())!
# File lib/aquarium/aspects/exclusion_handler.rb, line 33
33: def is_excluded_join_point? jp
34: return false if @specification[:exclude_join_points].nil?
35: @specification[:exclude_join_points].find {|jp2| jp2 == jp || jp2.eql?(jp)}
36: end
# File lib/aquarium/aspects/exclusion_handler.rb, line 55
55: def is_excluded_method? method
56: is_explicitly_excluded_method?(method) or matches_excluded_method_regex?(method)
57: end
# File lib/aquarium/aspects/exclusion_handler.rb, line 14
14: def is_excluded_pointcut? jp
15: return false if all_excluded_pointcuts.empty?
16: all_excluded_pointcuts.find do |pc|
17: pc.join_points_matched.find do |jp2|
18: jp2 == jp || jp2.eql?(jp)
19: end
20: end
21: end
# File lib/aquarium/aspects/exclusion_handler.rb, line 38
38: def is_excluded_type_or_object? type_or_object
39: unless @specification[:exclude_objects].nil?
40: return true if @specification[:exclude_objects].include?(type_or_object)
41: end
42: unless @specification[:exclude_types_calculated].nil?
43: return true if @specification[:exclude_types_calculated].find do |t|
44: case t
45: when String: type_or_object.name.eql?(t)
46: when Symbol: type_or_object.name.eql?(t.to_s)
47: when Regexp: type_or_object.name =~ t
48: else type_or_object == t
49: end
50: end
51: end
52: false
53: end
# File lib/aquarium/aspects/exclusion_handler.rb, line 59
59: def is_explicitly_excluded_method? method
60: return false if @specification[:exclude_methods].nil?
61: @specification[:exclude_methods].include? method
62: end
# File lib/aquarium/aspects/exclusion_handler.rb, line 10
10: def join_point_excluded? jp
11: is_excluded_pointcut?(jp) or is_excluded_join_point?(jp) or is_excluded_type_or_object?(jp.type_or_object) or is_excluded_method?(jp.method_name)
12: end
# File lib/aquarium/aspects/exclusion_handler.rb, line 64
64: def matches_excluded_method_regex? method
65: return false if @specification[:exclude_methods].nil?
66: regexs = @specification[:exclude_methods].find_all {|s| s.kind_of? Regexp}
67: return false if regexs.empty?
68: regexs.find {|re| method.to_s =~ re}
69: end