module Aquarium::Aspects::ExclusionHandler

Defines methods shared by several classes that take :exclude_* arguments.

Public Instance Methods

all_excluded_pointcuts() click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
28 def all_excluded_pointcuts
29   @all_excluded_pointcuts ||= @specification[:exclude_pointcuts]
30 end
is_excluded_join_point?(jp) click to toggle source

Using @specification.include?(jp) doesn't always work correctly (it probably uses equal?())!

   # File lib/aquarium/aspects/exclusion_handler.rb
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
is_excluded_method?(method) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
55 def is_excluded_method? method
56   is_explicitly_excluded_method?(method) or matches_excluded_method_regex?(method)
57 end
is_excluded_pointcut?(jp) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
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
is_excluded_type_or_object?(type_or_object) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
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 then type_or_object.name.eql?(t)
46       when Symbol then type_or_object.name.eql?(t.to_s)
47       when Regexp then type_or_object.name =~ t
48       else type_or_object == t
49       end
50     end
51   end
52   false
53 end
is_explicitly_excluded_method?(method) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
59 def is_explicitly_excluded_method? method
60   return false if @specification[:exclude_methods].nil?
61   @specification[:exclude_methods].include? method
62 end
join_point_excluded?(jp) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
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
matches_excluded_method_regex?(method) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
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
set_calculated_excluded_pointcuts(excluded_pointcuts) click to toggle source
   # File lib/aquarium/aspects/exclusion_handler.rb
23 def set_calculated_excluded_pointcuts excluded_pointcuts
24   @calculated_excluded_pointcuts = excluded_pointcuts
25   @all_excluded_pointcuts = @specification[:exclude_pointcuts] | Set.new(@calculated_excluded_pointcuts)
26 end