aquarium 0.1.8 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +59 -2
- data/README +33 -16
- data/RELEASE-PLAN +28 -5
- data/UPGRADE +11 -0
- data/examples/aspect_design_example.rb +2 -2
- data/examples/aspect_design_example_spec.rb +2 -2
- data/examples/design_by_contract_example.rb +4 -4
- data/examples/design_by_contract_example_spec.rb +4 -4
- data/examples/method_missing_example.rb +4 -1
- data/examples/method_missing_example_spec.rb +4 -1
- data/examples/method_tracing_example.rb +2 -2
- data/examples/method_tracing_example_spec.rb +16 -16
- data/lib/aquarium/aspects/advice.rb +47 -25
- data/lib/aquarium/aspects/aspect.rb +81 -39
- data/lib/aquarium/aspects/dsl/aspect_dsl.rb +1 -1
- data/lib/aquarium/aspects/exclusion_handler.rb +2 -2
- data/lib/aquarium/aspects/join_point.rb +28 -28
- data/lib/aquarium/aspects/pointcut.rb +61 -15
- data/lib/aquarium/extras/design_by_contract.rb +7 -7
- data/lib/aquarium/finders.rb +0 -1
- data/lib/aquarium/finders/method_finder.rb +10 -20
- data/lib/aquarium/finders/type_finder.rb +141 -75
- data/lib/aquarium/utils.rb +1 -0
- data/lib/aquarium/utils/logic_error.rb +9 -0
- data/lib/aquarium/utils/method_utils.rb +4 -3
- data/lib/aquarium/utils/nil_object.rb +1 -0
- data/lib/aquarium/utils/type_utils.rb +19 -0
- data/lib/aquarium/version.rb +2 -2
- data/spec/aquarium/aspects/advice_chain_node_spec.rb +2 -2
- data/spec/aquarium/aspects/advice_spec.rb +28 -5
- data/spec/aquarium/aspects/aspect_invocation_spec.rb +522 -289
- data/spec/aquarium/aspects/aspect_spec.rb +59 -41
- data/spec/aquarium/aspects/aspect_with_nested_types_spec.rb +7 -7
- data/spec/aquarium/aspects/aspect_with_subtypes_spec.rb +2 -2
- data/spec/aquarium/aspects/concurrent_aspects_spec.rb +1 -2
- data/spec/aquarium/aspects/concurrent_aspects_with_objects_and_types_spec.rb +1 -1
- data/spec/aquarium/aspects/dsl/aspect_dsl_spec.rb +34 -34
- data/spec/aquarium/aspects/join_point_spec.rb +79 -0
- data/spec/aquarium/aspects/pointcut_or_composition_spec.rb +13 -3
- data/spec/aquarium/aspects/pointcut_spec.rb +310 -63
- data/spec/aquarium/extras/design_by_contract_spec.rb +4 -4
- data/spec/aquarium/finders/method_finder_spec.rb +208 -54
- data/spec/aquarium/finders/type_finder_spec.rb +24 -88
- data/spec/aquarium/finders/type_finder_with_descendents_and_ancestors_spec.rb +206 -0
- data/spec/aquarium/spec_example_classes.rb +75 -12
- data/spec/aquarium/utils/logic_error_spec.rb +10 -0
- data/spec/aquarium/utils/type_utils_sample_classes.rb +203 -0
- data/spec/aquarium/utils/type_utils_spec.rb +47 -1
- metadata +48 -39
- data/lib/aquarium/finders/object_finder.rb +0 -75
- data/spec/aquarium/finders/object_finder_spec.rb +0 -231
@@ -0,0 +1,206 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../utils/type_utils_sample_classes'
|
3
|
+
require 'aquarium/finders/type_finder'
|
4
|
+
|
5
|
+
# TODO Mock out type_utils to speed it up!
|
6
|
+
|
7
|
+
def purge_actuals actuals
|
8
|
+
# Remove extra stuff inserted by RSpec, Aquarium, and "pretty printer" (rake?), possibly in other specs! (TODO undo those when finished...)
|
9
|
+
actuals.matched_keys.reject do |t2|
|
10
|
+
t2.name.include?("Spec::") or t2.name =~ /Aquarium::(Utils|Extras|Examples|Aspects)/ or t2.name =~ /^PP/
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
variant = ''
|
15
|
+
describe "#find with types, including descendents", :shared => true do
|
16
|
+
it "should find the matching types and their descendent subclasses, even in different nested modules." do
|
17
|
+
option = "#{variant}_and_descendents".intern
|
18
|
+
Aquarium::Utils::TypeUtils.sample_types.each do |t|
|
19
|
+
actual = Aquarium::Finders::TypeFinder.new.find option => (t.name)
|
20
|
+
actual_keys = purge_actuals actual
|
21
|
+
actual_keys.sort{|x,y| x.name <=> y.name}.should == Aquarium::Utils::TypeUtils.sample_types_descendents[t].sort{|x,y| x.name <=> y.name}
|
22
|
+
actual.not_matched_keys.should == []
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
%w[type types name names].each do |n|
|
28
|
+
instance_eval <<-EOF
|
29
|
+
describe Aquarium::Finders::TypeFinder, "#find with :#{n}_and_descendents used to specify one or more names" do
|
30
|
+
variant = "#{n}"
|
31
|
+
it_should_behave_like "#find with types, including descendents"
|
32
|
+
end
|
33
|
+
EOF
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#find with excluded types, including descendents", :shared => true do
|
37
|
+
it "should find the matching types and their descendent subclasses, minus the excluded type hierarchies." do
|
38
|
+
option = "#{variant}_and_descendents".intern
|
39
|
+
exclude_option = "exclude_#{variant}_and_descendents".intern
|
40
|
+
actual = Aquarium::Finders::TypeFinder.new.find option => ModuleForDescendents, exclude_option => D1ForDescendents
|
41
|
+
actual_keys = purge_actuals actual
|
42
|
+
expected = Aquarium::Utils::TypeUtils.sample_types_descendents[ModuleForDescendents].reject do |c|
|
43
|
+
Aquarium::Utils::TypeUtils.sample_types_descendents[D1ForDescendents].include? c
|
44
|
+
end
|
45
|
+
actual.not_matched_keys.should == []
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
%w[type types name names].each do |n|
|
50
|
+
instance_eval <<-EOF
|
51
|
+
describe Aquarium::Finders::TypeFinder, "#find with :exclude_#{n}_and_descendents used to specify one or more names" do
|
52
|
+
variant = "#{n}"
|
53
|
+
it_should_behave_like "#find with excluded types, including descendents"
|
54
|
+
end
|
55
|
+
EOF
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
describe "#find with types, including ancestors", :shared => true do
|
60
|
+
it "should find the matching types and their ancestors, even in different nested modules." do
|
61
|
+
option = "#{variant}_and_ancestors".intern
|
62
|
+
Aquarium::Utils::TypeUtils.sample_types.each do |t|
|
63
|
+
actual = Aquarium::Finders::TypeFinder.new.find option => (t.name)
|
64
|
+
actual_keys = purge_actuals actual
|
65
|
+
actual_keys.sort{|x,y| x.name <=> y.name}.should == Aquarium::Utils::TypeUtils.sample_types_ancestors[t].sort{|x,y| x.name <=> y.name}
|
66
|
+
actual.not_matched_keys.should == []
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
%w[type types name names].each do |n|
|
72
|
+
instance_eval <<-EOF
|
73
|
+
describe Aquarium::Finders::TypeFinder, "#find with :#{n}_and_ancestors used to specify one or more names" do
|
74
|
+
variant = "#{n}"
|
75
|
+
it_should_behave_like "#find with types, including ancestors"
|
76
|
+
end
|
77
|
+
EOF
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
describe "#find with excluded types, including ancestors", :shared => true do
|
82
|
+
it "should find the matching types and their ancestors, minus the excluded types and ancestors." do
|
83
|
+
option = "#{variant}_and_ancestors".intern
|
84
|
+
exclude_option = "exclude_#{variant}_and_ancestors".intern
|
85
|
+
actual = Aquarium::Finders::TypeFinder.new.find option => D1ForDescendents, exclude_option => ModuleForDescendents
|
86
|
+
actual_keys = purge_actuals actual
|
87
|
+
expected = Aquarium::Utils::TypeUtils.sample_types_ancestors[D1ForDescendents].reject do |c|
|
88
|
+
Aquarium::Utils::TypeUtils.sample_types_ancestors[ModuleForDescendents].include? c
|
89
|
+
end
|
90
|
+
actual.not_matched_keys.should == []
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
%w[type types name names].each do |n|
|
95
|
+
instance_eval <<-EOF
|
96
|
+
describe Aquarium::Finders::TypeFinder, "#find with :exclude_#{n}_and_ancestors used to specify one or more names" do
|
97
|
+
variant = "#{n}"
|
98
|
+
it_should_behave_like "#find with excluded types, including ancestors"
|
99
|
+
end
|
100
|
+
EOF
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
describe "#find with types, including descendents and ancestors", :shared => true do
|
105
|
+
it "should find the matching types, including their descendents and ancestors, even in different nested modules." do
|
106
|
+
doption = "#{variant}_and_descendents".intern
|
107
|
+
aoption = "#{variant}_and_ancestors".intern
|
108
|
+
Aquarium::Utils::TypeUtils.sample_types.each do |t|
|
109
|
+
actual = Aquarium::Finders::TypeFinder.new.find aoption => (t.name), doption => (t.name)
|
110
|
+
actual_keys = purge_actuals actual
|
111
|
+
expected = Aquarium::Utils::TypeUtils.sample_types_ancestors[t] + Aquarium::Utils::TypeUtils.sample_types_descendents[t]
|
112
|
+
actual_keys.sort{|x,y| x.name <=> y.name}.should == expected.sort{|x,y| x.name <=> y.name}.uniq
|
113
|
+
actual.not_matched_keys.should == []
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
%w[type types name names].each do |n|
|
119
|
+
instance_eval <<-EOF
|
120
|
+
describe Aquarium::Finders::TypeFinder, "#find with :#{n}_and_ancestors and :#{n}_and_descendents used to specify one or more names" do
|
121
|
+
variant = "#{n}"
|
122
|
+
it_should_behave_like "#find with types, including descendents and ancestors"
|
123
|
+
end
|
124
|
+
EOF
|
125
|
+
end
|
126
|
+
|
127
|
+
describe "#find with excluded types, including descendents and ancestors", :shared => true do
|
128
|
+
it "should find the matching types, their descendents and ancestors, minus the excluded types, descendents and ancestors." do
|
129
|
+
doption = "#{variant}_and_descendents".intern
|
130
|
+
aoption = "#{variant}_and_ancestors".intern
|
131
|
+
exclude_doption = "exclude_#{variant}_and_descendents".intern
|
132
|
+
exclude_aoption = "exclude_#{variant}_and_ancestors".intern
|
133
|
+
actual = Aquarium::Finders::TypeFinder.new.find aoption => Aquarium::ForDescendents::NestedD1ForDescendents,
|
134
|
+
doption => Aquarium::ForDescendents::NestedD1ForDescendents,
|
135
|
+
exclude_aoption => Aquarium::ForDescendents::NestedD2ForDescendents,
|
136
|
+
exclude_doption => Aquarium::ForDescendents::NestedD2ForDescendents
|
137
|
+
actual_keys = purge_actuals actual
|
138
|
+
expected = Aquarium::Utils::TypeUtils.sample_types_ancestors[D1ForDescendents].reject do |c|
|
139
|
+
Aquarium::Utils::TypeUtils.sample_types_ancestors[ModuleForDescendents].include? c
|
140
|
+
end
|
141
|
+
actual.not_matched_keys.should == []
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
%w[type types name names].each do |n|
|
146
|
+
instance_eval <<-EOF
|
147
|
+
describe Aquarium::Finders::TypeFinder, "#find with :exclude_#{n}_and_ancestors and :exclude_#{n}_and_descendents used to specify one or more names" do
|
148
|
+
variant = "#{n}"
|
149
|
+
it_should_behave_like "#find with excluded types, including descendents and ancestors"
|
150
|
+
end
|
151
|
+
EOF
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
describe "#find with regular expressions, including descendents and ancestors", :shared => true do
|
156
|
+
it "should find the matching types, including their descendents and ancestors, even in different nested modules." do
|
157
|
+
doption = "#{variant}_and_descendents".intern
|
158
|
+
aoption = "#{variant}_and_ancestors".intern
|
159
|
+
regexs = [/ForDescendents$/, /Aquarium::ForDescendents::.*ForDescendents/]
|
160
|
+
actual = Aquarium::Finders::TypeFinder.new.find aoption => regexs, doption => regexs
|
161
|
+
actual_keys = purge_actuals actual
|
162
|
+
expected = Aquarium::Utils::TypeUtils.sample_types_descendents_and_ancestors.keys + [Kernel, Object]
|
163
|
+
actual_keys.size.should == expected.size
|
164
|
+
expected.each do |t|
|
165
|
+
actual_keys.should include(t)
|
166
|
+
end
|
167
|
+
actual.not_matched_keys.should == []
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
%w[type types name names].each do |n|
|
172
|
+
instance_eval <<-EOF
|
173
|
+
describe Aquarium::Finders::TypeFinder, "#find regexps with :#{n}_and_ancestors and :#{n}_and_descendents used to specify one or more names" do
|
174
|
+
variant = "#{n}"
|
175
|
+
it_should_behave_like "#find with regular expressions, including descendents and ancestors"
|
176
|
+
end
|
177
|
+
EOF
|
178
|
+
end
|
179
|
+
|
180
|
+
|
181
|
+
describe "#find with excluded regular expressions, including descendents and ancestors", :shared => true do
|
182
|
+
it "should find the matching types, their descendents and ancestors, minus the excluded types, descendents and ancestors." do
|
183
|
+
doption = "#{variant}_and_descendents".intern
|
184
|
+
aoption = "#{variant}_and_ancestors".intern
|
185
|
+
exclude_doption = "exclude_#{variant}_and_descendents".intern
|
186
|
+
exclude_aoption = "exclude_#{variant}_and_ancestors".intern
|
187
|
+
actual = Aquarium::Finders::TypeFinder.new.find aoption => /Aquarium::ForDescendents::.*D1ForDescendents/,
|
188
|
+
doption => /Aquarium::ForDescendents::.*D1ForDescendents/,
|
189
|
+
exclude_aoption => /Aquarium::ForDescendents::.*D2ForDescendents/,
|
190
|
+
exclude_doption => /Aquarium::ForDescendents::.*D2ForDescendents/
|
191
|
+
actual_keys = purge_actuals actual
|
192
|
+
expected = Aquarium::Utils::TypeUtils.sample_types_ancestors[D1ForDescendents].reject do |c|
|
193
|
+
Aquarium::Utils::TypeUtils.sample_types_ancestors[ModuleForDescendents].include? c
|
194
|
+
end
|
195
|
+
actual.not_matched_keys.should == []
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
%w[type types name names].each do |n|
|
200
|
+
instance_eval <<-EOF
|
201
|
+
describe Aquarium::Finders::TypeFinder, "#find regexps with :exclude_#{n}_and_ancestors and :exclude_#{n}_and_descendents used to specify one or more names" do
|
202
|
+
variant = "#{n}"
|
203
|
+
it_should_behave_like "#find with excluded regular expressions, including descendents and ancestors"
|
204
|
+
end
|
205
|
+
EOF
|
206
|
+
end
|
@@ -11,39 +11,87 @@ class ExampleParentClass
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class ClassWithPublicInstanceMethod < ExampleParentClass
|
14
|
-
def public_instance_test_method
|
15
|
-
end
|
14
|
+
def public_instance_test_method; end
|
16
15
|
end
|
17
16
|
class ClassWithPublicInstanceMethod2 < ExampleParentClass
|
18
|
-
def public_instance_test_method2
|
19
|
-
end
|
17
|
+
def public_instance_test_method2; end
|
20
18
|
end
|
21
19
|
class ClassWithProtectedInstanceMethod < ExampleParentClass
|
22
20
|
protected
|
23
|
-
def protected_instance_test_method
|
24
|
-
end
|
21
|
+
def protected_instance_test_method; end
|
25
22
|
end
|
26
23
|
class ClassWithPrivateInstanceMethod < ExampleParentClass
|
27
24
|
private
|
28
|
-
def private_instance_test_method
|
29
|
-
end
|
25
|
+
def private_instance_test_method; end
|
30
26
|
end
|
31
27
|
|
32
28
|
class ClassWithPublicClassMethod < ExampleParentClass
|
33
|
-
def self.public_class_test_method
|
34
|
-
end
|
29
|
+
def self.public_class_test_method; end
|
35
30
|
end
|
36
31
|
class ClassWithPrivateClassMethod < ExampleParentClass
|
37
|
-
def self.private_class_test_method
|
38
|
-
end
|
32
|
+
def self.private_class_test_method; end
|
39
33
|
private_class_method :private_class_test_method
|
40
34
|
end
|
41
35
|
|
36
|
+
module ModuleWithPublicInstanceMethod
|
37
|
+
def public_instance_module_test_method; end
|
38
|
+
end
|
39
|
+
module ModuleWithProtectedInstanceMethod
|
40
|
+
protected
|
41
|
+
def protected_instance_module_test_method; end
|
42
|
+
end
|
43
|
+
module ModuleWithPrivateInstanceMethod
|
44
|
+
private
|
45
|
+
def private_instance_module_test_method; end
|
46
|
+
end
|
47
|
+
|
48
|
+
module ModuleWithPublicClassMethod
|
49
|
+
def self.public_class_module_test_method; end
|
50
|
+
end
|
51
|
+
module ModuleWithPrivateClassMethod
|
52
|
+
def self.private_class_module_test_method; end
|
53
|
+
private_class_method :private_class_module_test_method
|
54
|
+
end
|
55
|
+
|
56
|
+
class ClassIncludingModuleWithPublicInstanceMethod
|
57
|
+
include ModuleWithPublicInstanceMethod
|
58
|
+
def public_instance_class_including_module_test_method; end
|
59
|
+
end
|
60
|
+
class ClassIncludingModuleWithProtectedInstanceMethod
|
61
|
+
include ModuleWithProtectedInstanceMethod
|
62
|
+
protected
|
63
|
+
def protected_instance_class_including_module_test_method; end
|
64
|
+
end
|
65
|
+
class ClassIncludingModuleWithPrivateInstanceMethod
|
66
|
+
include ModuleWithPrivateInstanceMethod
|
67
|
+
private
|
68
|
+
def private_instance_class_including_module_test_method; end
|
69
|
+
end
|
70
|
+
class ClassIncludingModuleWithPublicClassMethod
|
71
|
+
include ModuleWithPublicClassMethod
|
72
|
+
def self.public_class_class_including_module_test_method; end
|
73
|
+
end
|
74
|
+
class ClassIncludingModuleWithPrivateClassMethod
|
75
|
+
include ModuleWithPrivateClassMethod
|
76
|
+
def self.private_class_class_including_module_test_method; end
|
77
|
+
private_class_method :private_class_class_including_module_test_method
|
78
|
+
end
|
79
|
+
|
80
|
+
module ModuleIncludingModuleWithPublicInstanceMethod
|
81
|
+
include ModuleWithPublicInstanceMethod
|
82
|
+
def public_instance_module_including_module_test_method; end
|
83
|
+
end
|
84
|
+
class ClassDerivedFromClassIncludingModuleWithPublicInstanceMethod < ClassIncludingModuleWithPublicInstanceMethod
|
85
|
+
include ModuleIncludingModuleWithPublicInstanceMethod
|
86
|
+
def public_instance_class_derived_from_class_including_module_test_method; end
|
87
|
+
end
|
88
|
+
|
42
89
|
class ClassWithAttribs < ExampleParentClass
|
43
90
|
attr_accessor :attrRW_ClassWithAttribs, :name
|
44
91
|
attr_reader :attrR_ClassWithAttribs
|
45
92
|
attr_writer :attrW_ClassWithAttribs
|
46
93
|
def initialize
|
94
|
+
super
|
47
95
|
@name = "Name"
|
48
96
|
end
|
49
97
|
def eql? other
|
@@ -57,6 +105,7 @@ class Watchful
|
|
57
105
|
class WatchfulError < Exception
|
58
106
|
def initialize message = nil
|
59
107
|
super
|
108
|
+
@message = message
|
60
109
|
end
|
61
110
|
end
|
62
111
|
|
@@ -136,3 +185,17 @@ class ExcludeTestThree
|
|
136
185
|
def method33; end
|
137
186
|
end
|
138
187
|
|
188
|
+
module TestableModule1
|
189
|
+
def module_method1; end
|
190
|
+
def module_method2; end
|
191
|
+
end
|
192
|
+
|
193
|
+
module TestableModule2
|
194
|
+
include TestableModule1
|
195
|
+
def module_method3; end
|
196
|
+
end
|
197
|
+
|
198
|
+
class TestableClassIncludingTestableModule1
|
199
|
+
include TestableModule1
|
200
|
+
def instance_method1; end
|
201
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper.rb'
|
2
|
+
require File.dirname(__FILE__) + '/../spec_example_classes'
|
3
|
+
require 'aquarium/utils/logic_error'
|
4
|
+
|
5
|
+
# This doesn't do much..., except make rcov happy, since this exception is essentially for catching bugs.
|
6
|
+
describe Aquarium::Utils::LogicError, ".new" do
|
7
|
+
it "should return an exception object" do
|
8
|
+
Aquarium::Utils::LogicError.new.kind_of?(Exception).should be_true
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,203 @@
|
|
1
|
+
class BaseForDescendents; end
|
2
|
+
module ModuleForDescendents; end
|
3
|
+
class D1ForDescendents < BaseForDescendents
|
4
|
+
include ModuleForDescendents
|
5
|
+
end
|
6
|
+
class D2ForDescendents < BaseForDescendents; end
|
7
|
+
class D11ForDescendents < D1ForDescendents; end
|
8
|
+
|
9
|
+
module Aquarium
|
10
|
+
module ForDescendents
|
11
|
+
class NestedBaseForDescendents; end
|
12
|
+
module NestedModuleForDescendents; end
|
13
|
+
class NestedD1ForDescendents < NestedBaseForDescendents
|
14
|
+
include NestedModuleForDescendents
|
15
|
+
end
|
16
|
+
class NestedD2ForDescendents < NestedBaseForDescendents; end
|
17
|
+
class NestedD11ForDescendents < NestedD1ForDescendents; end
|
18
|
+
|
19
|
+
class NestedD3ForDescendents < BaseForDescendents
|
20
|
+
include ModuleForDescendents
|
21
|
+
end
|
22
|
+
class NestedD4ForDescendents < BaseForDescendents; end
|
23
|
+
class NestedD31ForDescendents < D1ForDescendents; end
|
24
|
+
|
25
|
+
module Nested2ModuleForDescendents
|
26
|
+
include ModuleForDescendents
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Aquarium
|
32
|
+
module Utils
|
33
|
+
module TypeUtils
|
34
|
+
@@sample_modules = [
|
35
|
+
ModuleForDescendents,
|
36
|
+
Aquarium::ForDescendents::NestedModuleForDescendents,
|
37
|
+
Aquarium::ForDescendents::Nested2ModuleForDescendents]
|
38
|
+
|
39
|
+
@@sample_classes = [
|
40
|
+
BaseForDescendents,
|
41
|
+
D1ForDescendents,
|
42
|
+
D2ForDescendents,
|
43
|
+
D11ForDescendents,
|
44
|
+
Aquarium::ForDescendents::NestedBaseForDescendents,
|
45
|
+
Aquarium::ForDescendents::NestedD1ForDescendents,
|
46
|
+
Aquarium::ForDescendents::NestedD2ForDescendents,
|
47
|
+
Aquarium::ForDescendents::NestedD11ForDescendents,
|
48
|
+
Aquarium::ForDescendents::NestedD3ForDescendents,
|
49
|
+
Aquarium::ForDescendents::NestedD4ForDescendents,
|
50
|
+
Aquarium::ForDescendents::NestedD31ForDescendents]
|
51
|
+
|
52
|
+
@@sample_types = @@sample_modules + @@sample_classes
|
53
|
+
|
54
|
+
def self.sample_types; @@sample_types; end
|
55
|
+
def self.sample_modules; @@sample_modules; end
|
56
|
+
def self.sample_classes; @@sample_classes; end
|
57
|
+
|
58
|
+
|
59
|
+
@@sample_modules_descendents = {
|
60
|
+
ModuleForDescendents => [
|
61
|
+
Aquarium::ForDescendents::Nested2ModuleForDescendents,
|
62
|
+
Aquarium::ForDescendents::NestedD31ForDescendents,
|
63
|
+
Aquarium::ForDescendents::NestedD3ForDescendents,
|
64
|
+
D11ForDescendents,
|
65
|
+
D1ForDescendents,
|
66
|
+
ModuleForDescendents],
|
67
|
+
Aquarium::ForDescendents::NestedModuleForDescendents => [
|
68
|
+
Aquarium::ForDescendents::NestedD11ForDescendents,
|
69
|
+
Aquarium::ForDescendents::NestedD1ForDescendents,
|
70
|
+
Aquarium::ForDescendents::NestedModuleForDescendents],
|
71
|
+
Aquarium::ForDescendents::Nested2ModuleForDescendents => [
|
72
|
+
Aquarium::ForDescendents::Nested2ModuleForDescendents]}
|
73
|
+
|
74
|
+
@@sample_classes_descendents = {
|
75
|
+
BaseForDescendents => [
|
76
|
+
Aquarium::ForDescendents::NestedD31ForDescendents,
|
77
|
+
Aquarium::ForDescendents::NestedD3ForDescendents,
|
78
|
+
Aquarium::ForDescendents::NestedD4ForDescendents,
|
79
|
+
BaseForDescendents,
|
80
|
+
D11ForDescendents,
|
81
|
+
D1ForDescendents,
|
82
|
+
D2ForDescendents],
|
83
|
+
D1ForDescendents => [
|
84
|
+
Aquarium::ForDescendents::NestedD31ForDescendents,
|
85
|
+
D11ForDescendents,
|
86
|
+
D1ForDescendents],
|
87
|
+
D2ForDescendents => [D2ForDescendents],
|
88
|
+
D11ForDescendents => [D11ForDescendents],
|
89
|
+
Aquarium::ForDescendents::NestedBaseForDescendents => [
|
90
|
+
Aquarium::ForDescendents::NestedBaseForDescendents,
|
91
|
+
Aquarium::ForDescendents::NestedD11ForDescendents,
|
92
|
+
Aquarium::ForDescendents::NestedD1ForDescendents,
|
93
|
+
Aquarium::ForDescendents::NestedD2ForDescendents],
|
94
|
+
Aquarium::ForDescendents::NestedD1ForDescendents => [
|
95
|
+
Aquarium::ForDescendents::NestedD11ForDescendents,
|
96
|
+
Aquarium::ForDescendents::NestedD1ForDescendents],
|
97
|
+
Aquarium::ForDescendents::NestedD2ForDescendents => [
|
98
|
+
Aquarium::ForDescendents::NestedD2ForDescendents],
|
99
|
+
Aquarium::ForDescendents::NestedD11ForDescendents => [
|
100
|
+
Aquarium::ForDescendents::NestedD11ForDescendents],
|
101
|
+
Aquarium::ForDescendents::NestedD3ForDescendents => [
|
102
|
+
Aquarium::ForDescendents::NestedD3ForDescendents],
|
103
|
+
Aquarium::ForDescendents::NestedD4ForDescendents => [
|
104
|
+
Aquarium::ForDescendents::NestedD4ForDescendents],
|
105
|
+
Aquarium::ForDescendents::NestedD31ForDescendents => [
|
106
|
+
Aquarium::ForDescendents::NestedD31ForDescendents]}
|
107
|
+
|
108
|
+
@@sample_types_descendents = @@sample_classes_descendents.merge @@sample_modules_descendents
|
109
|
+
|
110
|
+
|
111
|
+
@@sample_modules_ancestors = {
|
112
|
+
ModuleForDescendents => [ModuleForDescendents],
|
113
|
+
Aquarium::ForDescendents::NestedModuleForDescendents => [Aquarium::ForDescendents::NestedModuleForDescendents],
|
114
|
+
Aquarium::ForDescendents::Nested2ModuleForDescendents => [
|
115
|
+
Aquarium::ForDescendents::Nested2ModuleForDescendents,
|
116
|
+
ModuleForDescendents]}
|
117
|
+
|
118
|
+
@@sample_classes_ancestors = {
|
119
|
+
BaseForDescendents => [
|
120
|
+
BaseForDescendents,
|
121
|
+
Object,
|
122
|
+
Kernel],
|
123
|
+
D1ForDescendents => [
|
124
|
+
D1ForDescendents,
|
125
|
+
ModuleForDescendents,
|
126
|
+
BaseForDescendents,
|
127
|
+
Object,
|
128
|
+
Kernel],
|
129
|
+
D2ForDescendents => [
|
130
|
+
D2ForDescendents,
|
131
|
+
BaseForDescendents,
|
132
|
+
Object,
|
133
|
+
Kernel],
|
134
|
+
D11ForDescendents => [
|
135
|
+
D11ForDescendents,
|
136
|
+
D1ForDescendents,
|
137
|
+
ModuleForDescendents,
|
138
|
+
BaseForDescendents,
|
139
|
+
Object,
|
140
|
+
Kernel],
|
141
|
+
Aquarium::ForDescendents::NestedBaseForDescendents => [
|
142
|
+
Aquarium::ForDescendents::NestedBaseForDescendents,
|
143
|
+
Object,
|
144
|
+
Kernel],
|
145
|
+
Aquarium::ForDescendents::NestedD1ForDescendents => [
|
146
|
+
Aquarium::ForDescendents::NestedD1ForDescendents,
|
147
|
+
Aquarium::ForDescendents::NestedModuleForDescendents,
|
148
|
+
Aquarium::ForDescendents::NestedBaseForDescendents,
|
149
|
+
Object,
|
150
|
+
Kernel],
|
151
|
+
Aquarium::ForDescendents::NestedD2ForDescendents => [
|
152
|
+
Aquarium::ForDescendents::NestedD2ForDescendents,
|
153
|
+
Aquarium::ForDescendents::NestedBaseForDescendents,
|
154
|
+
Object,
|
155
|
+
Kernel],
|
156
|
+
Aquarium::ForDescendents::NestedD11ForDescendents => [
|
157
|
+
Aquarium::ForDescendents::NestedD11ForDescendents,
|
158
|
+
Aquarium::ForDescendents::NestedD1ForDescendents,
|
159
|
+
Aquarium::ForDescendents::NestedModuleForDescendents,
|
160
|
+
Aquarium::ForDescendents::NestedBaseForDescendents,
|
161
|
+
Object,
|
162
|
+
Kernel],
|
163
|
+
Aquarium::ForDescendents::NestedD3ForDescendents => [
|
164
|
+
Aquarium::ForDescendents::NestedD3ForDescendents,
|
165
|
+
ModuleForDescendents,
|
166
|
+
BaseForDescendents,
|
167
|
+
Object,
|
168
|
+
Kernel],
|
169
|
+
Aquarium::ForDescendents::NestedD4ForDescendents => [
|
170
|
+
Aquarium::ForDescendents::NestedD4ForDescendents,
|
171
|
+
BaseForDescendents,
|
172
|
+
Object,
|
173
|
+
Kernel],
|
174
|
+
Aquarium::ForDescendents::NestedD31ForDescendents => [
|
175
|
+
Aquarium::ForDescendents::NestedD31ForDescendents,
|
176
|
+
D1ForDescendents,
|
177
|
+
ModuleForDescendents,
|
178
|
+
BaseForDescendents,
|
179
|
+
Object,
|
180
|
+
Kernel]}
|
181
|
+
|
182
|
+
@@sample_types_ancestors = @@sample_classes_ancestors.merge @@sample_modules_ancestors
|
183
|
+
|
184
|
+
|
185
|
+
%w[types modules classes].each do |x|
|
186
|
+
class_eval <<-EOF
|
187
|
+
def self.sample_#{x}_descendents
|
188
|
+
@@sample_#{x}_descendents
|
189
|
+
end
|
190
|
+
def self.sample_#{x}_ancestors
|
191
|
+
@@sample_#{x}_ancestors
|
192
|
+
end
|
193
|
+
def self.sample_#{x}_descendents_and_ancestors
|
194
|
+
self.sample_#{x}_descendents & sample_#{x}_ancestors
|
195
|
+
end
|
196
|
+
EOF
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
|