aspect4r 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -11,6 +11,8 @@ Aspect Oriented Programming support for Ruby
11
11
 
12
12
  == Usage
13
13
 
14
+ API documentation: http://gcao.posterous.com/aspect4r-usage-and-public-api
15
+
14
16
  class A
15
17
  include Aspect4r
16
18
 
@@ -51,9 +53,11 @@ Aspect Oriented Programming support for Ruby
51
53
 
52
54
  == How does it work?
53
55
 
56
+ Execution model: http://gcao.posterous.com/aspect4r-documentation-advice-execution-model
57
+
54
58
  == TODO
55
59
 
56
- See github issues tab http://github.com/gcao/aspect4r/issues
60
+ See github issues http://github.com/gcao/aspect4r/issues
57
61
 
58
62
  == Note on Patches/Pull Requests
59
63
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
data/aspect4r.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aspect4r}
8
- s.version = "0.8.1"
8
+ s.version = "0.8.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Guoliang Cao"]
12
- s.date = %q{2010-06-11}
12
+ s.date = %q{2010-07-01}
13
13
  s.description = %q{AOP for ruby - use before, after and around to trim your fat methods and reduce code duplication}
14
14
  s.email = %q{gcao99@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -25,10 +25,12 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "aspect4r.gemspec",
28
+ "examples/advices_on_class_method_example.rb",
28
29
  "examples/after_example.rb",
29
30
  "examples/around_example.rb",
30
31
  "examples/before_example.rb",
31
32
  "examples/combined_example.rb",
33
+ "examples/test_advices_example.rb",
32
34
  "lib/aspect4r.rb",
33
35
  "lib/aspect4r/after.rb",
34
36
  "lib/aspect4r/around.rb",
@@ -36,7 +38,6 @@ Gem::Specification.new do |s|
36
38
  "lib/aspect4r/before.rb",
37
39
  "lib/aspect4r/classic.rb",
38
40
  "lib/aspect4r/errors.rb",
39
- "lib/aspect4r/extensions/class_extension.rb",
40
41
  "lib/aspect4r/extensions/module_extension.rb",
41
42
  "lib/aspect4r/helper.rb",
42
43
  "lib/aspect4r/model/advice.rb",
@@ -55,8 +56,11 @@ Gem::Specification.new do |s|
55
56
  "spec/aspect4r/class_inheritance_spec.rb",
56
57
  "spec/aspect4r/classic_spec.rb",
57
58
  "spec/aspect4r/helper_spec.rb",
59
+ "spec/aspect4r/include_advices_from_module_spec.rb",
58
60
  "spec/aspect4r/inheritance_inclusion_combined_spec.rb",
61
+ "spec/aspect4r/method_added_spec.rb",
59
62
  "spec/aspect4r/module_inclusion_spec.rb",
63
+ "spec/aspect4r/singleton_method_added_spec.rb",
60
64
  "spec/aspect4r/super_in_method_spec.rb",
61
65
  "spec/aspect4r_spec.rb",
62
66
  "spec/spec.opts",
@@ -85,8 +89,11 @@ Gem::Specification.new do |s|
85
89
  "spec/aspect4r/class_inheritance_spec.rb",
86
90
  "spec/aspect4r/classic_spec.rb",
87
91
  "spec/aspect4r/helper_spec.rb",
92
+ "spec/aspect4r/include_advices_from_module_spec.rb",
88
93
  "spec/aspect4r/inheritance_inclusion_combined_spec.rb",
94
+ "spec/aspect4r/method_added_spec.rb",
89
95
  "spec/aspect4r/module_inclusion_spec.rb",
96
+ "spec/aspect4r/singleton_method_added_spec.rb",
90
97
  "spec/aspect4r/super_in_method_spec.rb",
91
98
  "spec/aspect4r_spec.rb",
92
99
  "spec/spec_helper.rb",
@@ -96,11 +103,12 @@ Gem::Specification.new do |s|
96
103
  "test/combined_test.rb",
97
104
  "test/method_invocation_test.rb",
98
105
  "test/test_helper.rb",
106
+ "examples/advices_on_class_method_example.rb",
99
107
  "examples/after_example.rb",
100
108
  "examples/around_example.rb",
101
109
  "examples/before_example.rb",
102
110
  "examples/combined_example.rb",
103
- "examples/method_to_advices_example.rb"
111
+ "examples/test_advices_example.rb"
104
112
  ]
105
113
 
106
114
  if s.respond_to? :specification_version then
@@ -0,0 +1,40 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'aspect4r'
4
+
5
+ class A
6
+ class << self
7
+ include Aspect4r
8
+
9
+ around :test do |proxy, input|
10
+ puts 'around test (before)'
11
+ result = a4r_invoke proxy, input
12
+ puts 'around test (after)'
13
+ result
14
+ end
15
+
16
+ before :test do |input|
17
+ puts 'before test'
18
+ end
19
+
20
+ after :test do |result, input|
21
+ puts 'after test'
22
+ result
23
+ end
24
+
25
+ def test input
26
+ puts 'test'
27
+ input
28
+ end
29
+ end
30
+ end
31
+
32
+ puts "Example 1:"
33
+ puts A.test(1)
34
+ # ==== Output ====
35
+ # before test
36
+ # around test (before)
37
+ # test
38
+ # around test (after)
39
+ # after test
40
+ # 1
@@ -0,0 +1,121 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'rubygems'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+ config.mock_with :mocha
9
+ end
10
+
11
+ require 'aspect4r'
12
+
13
+ # ======================= Class to be tested =================================
14
+ class Klass
15
+ include Aspect4r
16
+
17
+ attr :value
18
+
19
+ def initialize
20
+ @value = []
21
+ end
22
+
23
+ around :test do |proxy, input|
24
+ @value << "around(before)"
25
+ a4r_invoke proxy, input
26
+ @value << "around(after)"
27
+ end
28
+
29
+ before :test, :name => 'before_advice' do |input|
30
+ @value << 'before'
31
+ end
32
+
33
+ before_filter :test do |input|
34
+ @value << 'before_filter'
35
+ input >= 0
36
+ end
37
+
38
+ after :test do |result, input|
39
+ @value << "after"
40
+ result * 100
41
+ end
42
+
43
+ def test input
44
+ @value << "test"
45
+ end
46
+ end
47
+
48
+ # =============================== Tests start here ===========================
49
+ describe Klass do
50
+ it "number of advices" do
51
+ Klass.a4r_data[:test].size.should == 4
52
+ end
53
+
54
+ it "around advice" do
55
+ advice = Klass.a4r_data[:test][0]
56
+ advice.around?.should be_true
57
+
58
+ o = Klass.new
59
+ o.expects(:a4r_invoke).with(:proxy, 1)
60
+
61
+ advice.invoke(o, :proxy, 1)
62
+
63
+ o.value.should == %w(around(before) around(after))
64
+ end
65
+
66
+ it "before advice" do
67
+ advice = Klass.a4r_data[:test][1]
68
+ advice.before?.should be_true
69
+
70
+ o = Klass.new
71
+ advice.invoke(o, 1)
72
+
73
+ o.value.should == %w(before)
74
+ end
75
+
76
+ it "before advice retrieved by name" do
77
+ advice = Klass.a4r_data[:test][:before_advice]
78
+ advice.before?.should be_true
79
+
80
+ o = Klass.new
81
+ advice.invoke(o, 1)
82
+
83
+ o.value.should == %w(before)
84
+ end
85
+
86
+ it "before_filter advice returns true if input is not negative" do
87
+ advice = Klass.a4r_data[:test][2]
88
+ advice.before_filter?.should be_true
89
+
90
+ o = Klass.new
91
+ advice.invoke(o, 1).should be_true
92
+
93
+ o.value.should == %w(before_filter)
94
+ end
95
+
96
+ it "before_filter advice returns false if input is negative" do
97
+ advice = Klass.a4r_data[:test][2]
98
+
99
+ o = Klass.new
100
+ advice.invoke(o, -1).should be_false
101
+ end
102
+
103
+ it "after advice" do
104
+ advice = Klass.a4r_data[:test][3]
105
+ advice.after?.should be_true
106
+
107
+ o = Klass.new
108
+ advice.invoke(o, 1, 1).should == 100
109
+
110
+ o.value.should == %w(after)
111
+ end
112
+
113
+ it "test method without advices" do
114
+ Klass.a4r_disable_advices_temporarily :test do
115
+ o = Klass.new
116
+ o.test 1
117
+
118
+ o.value.should == %w(test)
119
+ end
120
+ end
121
+ end
data/lib/aspect4r/base.rb CHANGED
@@ -7,7 +7,6 @@ require 'aspect4r/return_this'
7
7
 
8
8
  require 'aspect4r/helper'
9
9
 
10
- require 'aspect4r/extensions/class_extension'
11
10
  require 'aspect4r/extensions/module_extension'
12
11
 
13
12
  module Aspect4r
@@ -15,6 +14,7 @@ module Aspect4r
15
14
  def self.included(base)
16
15
  base.send(:include, InstanceMethods)
17
16
  base.extend(ClassMethods)
17
+ base.instance_variable_set('@a4r_data', Aspect4r::Model::AspectData.new(base))
18
18
  end
19
19
 
20
20
  module InstanceMethods
@@ -28,11 +28,11 @@ module Aspect4r
28
28
  @a4r_data ||= Aspect4r::Model::AspectData.new(self)
29
29
  end
30
30
 
31
- def a4r_group
31
+ def a4r_group &block
32
32
  a4r_data.change_group
33
33
 
34
34
  if block_given?
35
- yield
35
+ instance_eval &block
36
36
  a4r_data.change_group
37
37
  end
38
38
  end
@@ -1,18 +1,4 @@
1
1
  class Module
2
- def included_with_a4r(base)
3
- included_without_a4r(base)
4
-
5
- return if @a4r_data.nil? or @a4r_data.empty?
6
-
7
- base.send(:include, Aspect4r)
8
-
9
- existing_aspects = base.a4r_data
10
- existing_aspects.methods_with_advices.merge(@a4r_data.methods_with_advices)
11
- end
12
-
13
- alias included_without_a4r included
14
- alias included included_with_a4r
15
-
16
2
  def method_added_with_a4r(method)
17
3
  method_added_without_a4r(method)
18
4
 
@@ -34,7 +20,12 @@ class Module
34
20
  return if method.to_s =~ /a4r/
35
21
 
36
22
  # save unbound method and create new method
37
- eigen_class = Aspect4r::Helper.eigen_class(self)
23
+ eigen_class = instance_eval do
24
+ class << self
25
+ self
26
+ end
27
+ end
28
+
38
29
  my_advices = eigen_class.instance_variable_get(:@a4r_data)
39
30
 
40
31
  if my_advices and method_advices = my_advices[method] and not Aspect4r::Helper.creating_method?
@@ -20,14 +20,6 @@ module Aspect4r
20
20
  @creating_method = false
21
21
  end
22
22
 
23
- def self.eigen_class klass_or_module
24
- klass_or_module.module_eval do
25
- class << self
26
- self
27
- end
28
- end
29
- end
30
-
31
23
  # Store original method in aspect data and refer to it whenever recreating method
32
24
  def self.process_advice meta_data, klass_or_module, *methods, &block
33
25
  methods.flatten!
@@ -49,7 +41,6 @@ module Aspect4r
49
41
 
50
42
  methods.each do |method|
51
43
  method = method.to_sym
52
- klass_or_module.a4r_data.methods_with_advices << method
53
44
 
54
45
  aspect = a4r_data[method] ||= Aspect4r::Model::AdvicesForMethod.new(method)
55
46
  aspect.add advice
@@ -76,58 +67,22 @@ module Aspect4r
76
67
 
77
68
  aspect.each do |advice|
78
69
  if ((group and group != advice.group) or advice.around?) and not grouped_advices.empty?
79
- # wrap up advices before current advice
80
- create_method_for_before_after_advices klass, method, grouped_advices, inner_most
70
+ create_method_with_advices klass, method, grouped_advices, inner_most
81
71
 
82
72
  grouped_advices = []
83
73
  inner_most = false
84
74
  end
85
75
 
86
- # handle current advice
87
- if advice.around?
88
- create_method_for_around_advice klass, method, advice, inner_most
89
- inner_most = false
90
- else
91
- grouped_advices << advice
92
- end
93
-
94
- group = advice.group
76
+ grouped_advices << advice
77
+ group = advice.group
95
78
  end
96
79
 
97
80
  # create wrap method for before/after advices which are not wrapped inside around advice.
98
- unless grouped_advices.empty?
99
- create_method_for_before_after_advices klass, method, grouped_advices, inner_most unless grouped_advices.empty?
100
- end
81
+ create_method_with_advices klass, method, grouped_advices, inner_most unless grouped_advices.empty?
101
82
  ensure
102
83
  @creating_method = nil
103
84
  end
104
85
 
105
- # method
106
- # advice
107
- WRAP_METHOD_TEMPLATE = ERB.new <<-CODE, nil, '<>'
108
- <% if inner_most %>
109
- wrapped_method = a4r_data[:<%= method %>].wrapped_method
110
- <% else %>
111
- wrapped_method = instance_method(:<%= method %>)
112
- <% end %>
113
-
114
- define_method :<%= method %> do |*args|
115
- <% if advice.options[:method_name_arg] %>
116
- result = <%= advice.with_method %> '<%= method %>', wrapped_method, *args
117
- <% else %>
118
- result = <%= advice.with_method %> wrapped_method, *args
119
- <% end %>
120
-
121
- result
122
- end
123
- CODE
124
-
125
- def self.create_method_for_around_advice klass, method, advice, inner_most
126
- code = WRAP_METHOD_TEMPLATE.result(binding)
127
- # puts code
128
- klass.class_eval code, __FILE__
129
- end
130
-
131
86
  # method
132
87
  # before_advices
133
88
  # after_advices
@@ -155,8 +110,17 @@ module Aspect4r
155
110
  <% end %>
156
111
  <% end %>
157
112
 
158
- # Call wrapped method
113
+ <% if around_advice %>
114
+ # around advice
115
+ <% if around_advice.options[:method_name_arg] %>
116
+ result = <%= around_advice.with_method %> '<%= method %>', wrapped_method, *args
117
+ <% else %>
118
+ result = <%= around_advice.with_method %> wrapped_method, *args
119
+ <% end %>
120
+ <% else %>
121
+ # Invoke wrapped method
159
122
  result = wrapped_method.bind(self).call *args
123
+ <% end %>
160
124
 
161
125
  # After advices
162
126
  <% after_advices.each do |definition| %>
@@ -175,9 +139,10 @@ module Aspect4r
175
139
  end
176
140
  CODE
177
141
 
178
- def self.create_method_for_before_after_advices klass, method, advices, inner_most
142
+ def self.create_method_with_advices klass, method, advices, inner_most
179
143
  before_advices = advices.select {|advice| advice.before? or advice.before_filter? }
180
144
  after_advices = advices.select {|advice| advice.after? }
145
+ around_advice = advices.first if advices.first.around?
181
146
 
182
147
  code = METHOD_TEMPLATE.result(binding)
183
148
  # puts code
@@ -18,10 +18,6 @@ module Aspect4r
18
18
  def change_group
19
19
  @group_index = group_index + 1
20
20
  end
21
-
22
- def methods_with_advices
23
- @methods_with_advices ||= Set.new
24
- end
25
21
  end
26
22
  end
27
23
  end
@@ -14,6 +14,10 @@ describe "Group of advices" do
14
14
  def test
15
15
  @value << "test"
16
16
  end
17
+
18
+ before :test do
19
+ @value << "before"
20
+ end
17
21
 
18
22
  a4r_group do
19
23
  before :test do
@@ -31,6 +35,6 @@ describe "Group of advices" do
31
35
  o = klass.new
32
36
  o.test
33
37
 
34
- o.value.should == %w(before(group2) before(group1) test)
38
+ o.value.should == %w(before(group2) before(group1) before test)
35
39
  end
36
40
  end
@@ -0,0 +1,89 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Aspect4r do
4
+ it "Mix advices from module" do
5
+ module AdvicesMod
6
+ include Aspect4r
7
+
8
+ def before_test
9
+ @value << "before(module)"
10
+ end
11
+
12
+ def self.included(base)
13
+ super
14
+
15
+ base.send :include, Aspect4r
16
+ base.before :test, :before_test
17
+ end
18
+ end
19
+
20
+ klass = Class.new do
21
+ include Aspect4r
22
+
23
+ attr :value
24
+
25
+ def initialize
26
+ @value = []
27
+ end
28
+
29
+ before :test do
30
+ @value << 'before'
31
+ end
32
+
33
+ def test
34
+ @value << 'test'
35
+ end
36
+
37
+ include AdvicesMod
38
+ end
39
+
40
+ o = klass.new
41
+ o.test
42
+
43
+ o.value.should == %w(before before(module) test)
44
+ end
45
+
46
+ it "Mix advice group from module" do
47
+ module AdvicesMod1
48
+ include Aspect4r
49
+
50
+ def before_test
51
+ @value << "before(module)"
52
+ end
53
+
54
+ def self.included(base)
55
+ super
56
+
57
+ base.send :include, Aspect4r
58
+ base.a4r_group do
59
+ before :test, :before_test
60
+ end
61
+ end
62
+ end
63
+
64
+ klass = Class.new do
65
+ include Aspect4r
66
+
67
+ attr :value
68
+
69
+ def initialize
70
+ @value = []
71
+ end
72
+
73
+ before :test do
74
+ @value << 'before'
75
+ end
76
+
77
+ def test
78
+ @value << 'test'
79
+ end
80
+
81
+ include AdvicesMod1
82
+ end
83
+
84
+ o = klass.new
85
+ o.test
86
+
87
+ o.value.should == %w(before(module) before test)
88
+ end
89
+ end
@@ -0,0 +1,42 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "method_added" do
4
+ it "should work if target method is defined after method_added and method_added calls super" do
5
+ klass = Class.new do
6
+ include Aspect4r
7
+
8
+ attr :value
9
+
10
+ def initialize
11
+ @value = []
12
+ end
13
+
14
+ around :test do |proxy|
15
+ @value << "around1"
16
+ a4r_invoke proxy
17
+ @value << "around2"
18
+ end
19
+
20
+ before :test do
21
+ @value << "before"
22
+ end
23
+
24
+ after :test do |result|
25
+ @value << "after"
26
+ end
27
+
28
+ def self.method_added(method)
29
+ super
30
+ end
31
+
32
+ def test
33
+ @value << "test"
34
+ end
35
+ end
36
+
37
+ o = klass.new
38
+ o.test
39
+
40
+ o.value.should == %w(before around1 test around2 after)
41
+ end
42
+ end
@@ -0,0 +1,40 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "singleton_method_added" do
4
+ it "should work if target method is defined after singleton_method_added and singleton_method_added calls super" do
5
+ class AdvicesOnClassMethod1
6
+ def self.singleton_method_added(method)
7
+ super
8
+ end
9
+
10
+ class << self
11
+ include Aspect4r
12
+
13
+ def value
14
+ @value ||= []
15
+ end
16
+
17
+ around :test do |proxy|
18
+ value << "around1"
19
+ a4r_invoke proxy
20
+ value << "around2"
21
+ end
22
+
23
+ before :test do
24
+ value << "before"
25
+ end
26
+
27
+ after :test do |result|
28
+ value << "after"
29
+ end
30
+
31
+ def test
32
+ value << "test"
33
+ end
34
+ end
35
+ end
36
+
37
+ AdvicesOnClassMethod1.test
38
+ AdvicesOnClassMethod1.value.should == %w(before around1 test around2 after)
39
+ end
40
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspect4r
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 1
10
- version: 0.8.1
9
+ - 2
10
+ version: 0.8.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Guoliang Cao
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-11 00:00:00 -04:00
18
+ date: 2010-07-01 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -52,10 +52,12 @@ files:
52
52
  - Rakefile
53
53
  - VERSION
54
54
  - aspect4r.gemspec
55
+ - examples/advices_on_class_method_example.rb
55
56
  - examples/after_example.rb
56
57
  - examples/around_example.rb
57
58
  - examples/before_example.rb
58
59
  - examples/combined_example.rb
60
+ - examples/test_advices_example.rb
59
61
  - lib/aspect4r.rb
60
62
  - lib/aspect4r/after.rb
61
63
  - lib/aspect4r/around.rb
@@ -63,7 +65,6 @@ files:
63
65
  - lib/aspect4r/before.rb
64
66
  - lib/aspect4r/classic.rb
65
67
  - lib/aspect4r/errors.rb
66
- - lib/aspect4r/extensions/class_extension.rb
67
68
  - lib/aspect4r/extensions/module_extension.rb
68
69
  - lib/aspect4r/helper.rb
69
70
  - lib/aspect4r/model/advice.rb
@@ -82,8 +83,11 @@ files:
82
83
  - spec/aspect4r/class_inheritance_spec.rb
83
84
  - spec/aspect4r/classic_spec.rb
84
85
  - spec/aspect4r/helper_spec.rb
86
+ - spec/aspect4r/include_advices_from_module_spec.rb
85
87
  - spec/aspect4r/inheritance_inclusion_combined_spec.rb
88
+ - spec/aspect4r/method_added_spec.rb
86
89
  - spec/aspect4r/module_inclusion_spec.rb
90
+ - spec/aspect4r/singleton_method_added_spec.rb
87
91
  - spec/aspect4r/super_in_method_spec.rb
88
92
  - spec/aspect4r_spec.rb
89
93
  - spec/spec.opts
@@ -94,7 +98,6 @@ files:
94
98
  - test/combined_test.rb
95
99
  - test/method_invocation_test.rb
96
100
  - test/test_helper.rb
97
- - examples/method_to_advices_example.rb
98
101
  has_rdoc: true
99
102
  homepage: http://github.com/gcao/aspect4r
100
103
  licenses: []
@@ -141,8 +144,11 @@ test_files:
141
144
  - spec/aspect4r/class_inheritance_spec.rb
142
145
  - spec/aspect4r/classic_spec.rb
143
146
  - spec/aspect4r/helper_spec.rb
147
+ - spec/aspect4r/include_advices_from_module_spec.rb
144
148
  - spec/aspect4r/inheritance_inclusion_combined_spec.rb
149
+ - spec/aspect4r/method_added_spec.rb
145
150
  - spec/aspect4r/module_inclusion_spec.rb
151
+ - spec/aspect4r/singleton_method_added_spec.rb
146
152
  - spec/aspect4r/super_in_method_spec.rb
147
153
  - spec/aspect4r_spec.rb
148
154
  - spec/spec_helper.rb
@@ -152,8 +158,9 @@ test_files:
152
158
  - test/combined_test.rb
153
159
  - test/method_invocation_test.rb
154
160
  - test/test_helper.rb
161
+ - examples/advices_on_class_method_example.rb
155
162
  - examples/after_example.rb
156
163
  - examples/around_example.rb
157
164
  - examples/before_example.rb
158
165
  - examples/combined_example.rb
159
- - examples/method_to_advices_example.rb
166
+ - examples/test_advices_example.rb
File without changes
@@ -1,15 +0,0 @@
1
- class Class
2
- def inherited_with_a4r(child)
3
- inherited_without_a4r(child) if respond_to?(:inherited_without_a4r, true)
4
-
5
- return if @a4r_data.nil? or @a4r_data.empty?
6
-
7
- a4r_data = Aspect4r::Model::AspectData.new(child)
8
- a4r_data.methods_with_advices.merge(@a4r_data.methods_with_advices)
9
-
10
- child.instance_variable_set('@a4r_data', a4r_data)
11
- end
12
-
13
- alias inherited_without_a4r inherited
14
- alias inherited inherited_with_a4r
15
- end