aspector 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/VERSION +1 -1
- data/aspector.gemspec +9 -8
- data/examples/exception_handler2.rb +45 -0
- data/lib/aspector/base.rb +7 -0
- metadata +162 -155
data/.rvmrc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.13.
|
1
|
+
0.13.1
|
data/aspector.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.13.
|
7
|
+
s.name = %q{aspector}
|
8
|
+
s.version = "0.13.1"
|
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 =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = %q{2013-01-23}
|
13
|
+
s.description = %q{}
|
14
|
+
s.email = %q{gcao99@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.rdoc"
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"examples/cache_aspect.rb",
|
38
38
|
"examples/design_by_contract.rb",
|
39
39
|
"examples/exception_handler.rb",
|
40
|
+
"examples/exception_handler2.rb",
|
40
41
|
"examples/implicit_method_option_test.rb",
|
41
42
|
"examples/logging_aspect.rb",
|
42
43
|
"examples/retry_aspect.rb",
|
@@ -80,11 +81,11 @@ Gem::Specification.new do |s|
|
|
80
81
|
"spec/unit/raw_spec.rb",
|
81
82
|
"spec/unit/special_chars_spec.rb"
|
82
83
|
]
|
83
|
-
s.homepage =
|
84
|
+
s.homepage = %q{http://github.com/gcao/aspector}
|
84
85
|
s.licenses = ["MIT"]
|
85
86
|
s.require_paths = ["lib"]
|
86
|
-
s.rubygems_version =
|
87
|
-
s.summary =
|
87
|
+
s.rubygems_version = %q{1.6.2}
|
88
|
+
s.summary = %q{Aspect Oriented Ruby Programming}
|
88
89
|
|
89
90
|
if s.respond_to? :specification_version then
|
90
91
|
s.specification_version = 3
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class A
|
2
|
+
|
3
|
+
def self.test input
|
4
|
+
puts input.upcase
|
5
|
+
end
|
6
|
+
|
7
|
+
def test input
|
8
|
+
puts input.upcase
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
##############################
|
14
|
+
|
15
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
16
|
+
|
17
|
+
require 'aspector'
|
18
|
+
|
19
|
+
class ExceptionHandler < Aspector::Base
|
20
|
+
|
21
|
+
target do
|
22
|
+
def handle_exception proxy, *args, &block
|
23
|
+
proxy.call *args, &block
|
24
|
+
rescue => e
|
25
|
+
puts "Rescued: #{e}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
around :handle_exception
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
##############################
|
34
|
+
|
35
|
+
ExceptionHandler.apply A, :method => "test", :class_methods => true
|
36
|
+
|
37
|
+
A.test 'good'
|
38
|
+
A.test nil
|
39
|
+
|
40
|
+
ExceptionHandler.apply A, :method => "test"
|
41
|
+
|
42
|
+
a = A.new
|
43
|
+
a.test 'good'
|
44
|
+
a.test nil
|
45
|
+
|
data/lib/aspector/base.rb
CHANGED
@@ -36,6 +36,7 @@ module Aspector
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def apply
|
39
|
+
include_extension_module
|
39
40
|
invoke_deferred_logics
|
40
41
|
define_methods_for_advice_blocks
|
41
42
|
add_to_instances unless @options[:old_methods_only]
|
@@ -96,6 +97,12 @@ module Aspector
|
|
96
97
|
|
97
98
|
private
|
98
99
|
|
100
|
+
def include_extension_module
|
101
|
+
if self.class.const_defined?(:ToBeIncluded)
|
102
|
+
context.send(:include, self.class.const_get(:ToBeIncluded))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
99
106
|
def deferred_logic_results logic
|
100
107
|
@deferred_logic_results[logic]
|
101
108
|
end
|
metadata
CHANGED
@@ -1,200 +1,199 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: aspector
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 41
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 13
|
9
|
+
- 1
|
10
|
+
version: 0.13.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Guoliang Cao
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
|
18
|
+
date: 2013-01-23 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
23
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
version_requirements: *id001
|
22
32
|
type: :development
|
33
|
+
name: rspec
|
23
34
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: jeweler
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
33
37
|
none: false
|
34
|
-
requirements:
|
38
|
+
requirements:
|
35
39
|
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 7
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 6
|
45
|
+
- 4
|
37
46
|
version: 1.6.4
|
47
|
+
version_requirements: *id002
|
38
48
|
type: :development
|
49
|
+
name: jeweler
|
39
50
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.6.4
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: ruby-prof
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
53
|
none: false
|
50
|
-
requirements:
|
51
|
-
- -
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
version_requirements: *id003
|
54
62
|
type: :development
|
63
|
+
name: ruby-prof
|
55
64
|
prerelease: false
|
56
|
-
|
57
|
-
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: guard
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
67
|
none: false
|
66
|
-
requirements:
|
68
|
+
requirements:
|
67
69
|
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 55
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
- 8
|
75
|
+
- 4
|
69
76
|
version: 0.8.4
|
77
|
+
version_requirements: *id004
|
70
78
|
type: :development
|
79
|
+
name: guard
|
71
80
|
prerelease: false
|
72
|
-
|
73
|
-
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 0.8.4
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: guard-bundler
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
83
|
none: false
|
82
|
-
requirements:
|
84
|
+
requirements:
|
83
85
|
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 29
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
- 1
|
91
|
+
- 3
|
85
92
|
version: 0.1.3
|
93
|
+
version_requirements: *id005
|
86
94
|
type: :development
|
95
|
+
name: guard-bundler
|
87
96
|
prerelease: false
|
88
|
-
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
89
99
|
none: false
|
90
|
-
requirements:
|
100
|
+
requirements:
|
91
101
|
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
hash: 15
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
- 5
|
107
|
+
- 2
|
101
108
|
version: 0.5.2
|
109
|
+
version_requirements: *id006
|
102
110
|
type: :development
|
111
|
+
name: guard-rspec
|
103
112
|
prerelease: false
|
104
|
-
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
105
115
|
none: false
|
106
|
-
requirements:
|
116
|
+
requirements:
|
107
117
|
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
requirements:
|
115
|
-
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
hash: 25
|
120
|
+
segments:
|
121
|
+
- 0
|
122
|
+
- 1
|
123
|
+
- 1
|
117
124
|
version: 0.1.1
|
125
|
+
version_requirements: *id007
|
118
126
|
type: :development
|
127
|
+
name: guard-shell
|
119
128
|
prerelease: false
|
120
|
-
|
121
|
-
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 0.1.1
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: rb-fsevent
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
129
131
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
hash: 3
|
136
|
+
segments:
|
137
|
+
- 0
|
138
|
+
version: "0"
|
139
|
+
version_requirements: *id008
|
134
140
|
type: :development
|
141
|
+
name: rb-fsevent
|
135
142
|
prerelease: false
|
136
|
-
|
137
|
-
|
138
|
-
requirements:
|
139
|
-
- - ! '>='
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: growl
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
145
145
|
none: false
|
146
|
-
requirements:
|
146
|
+
requirements:
|
147
147
|
- - ~>
|
148
|
-
- !ruby/object:Gem::Version
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
hash: 17
|
150
|
+
segments:
|
151
|
+
- 1
|
152
|
+
- 0
|
153
|
+
- 3
|
149
154
|
version: 1.0.3
|
155
|
+
version_requirements: *id009
|
150
156
|
type: :development
|
157
|
+
name: growl
|
151
158
|
prerelease: false
|
152
|
-
|
153
|
-
|
154
|
-
requirements:
|
155
|
-
- - ~>
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: 1.0.3
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: awesome_print
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
161
161
|
none: false
|
162
|
-
requirements:
|
163
|
-
- -
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
hash: 3
|
166
|
+
segments:
|
167
|
+
- 0
|
168
|
+
version: "0"
|
169
|
+
version_requirements: *id010
|
166
170
|
type: :development
|
171
|
+
name: awesome_print
|
167
172
|
prerelease: false
|
168
|
-
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
169
175
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
requirements:
|
179
|
-
- - ! '>='
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: '0'
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
hash: 3
|
180
|
+
segments:
|
181
|
+
- 0
|
182
|
+
version: "0"
|
183
|
+
version_requirements: *id011
|
182
184
|
type: :development
|
185
|
+
name: pry
|
183
186
|
prerelease: false
|
184
|
-
|
185
|
-
none: false
|
186
|
-
requirements:
|
187
|
-
- - ! '>='
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
version: '0'
|
190
|
-
description: ''
|
187
|
+
description: ""
|
191
188
|
email: gcao99@gmail.com
|
192
189
|
executables: []
|
190
|
+
|
193
191
|
extensions: []
|
194
|
-
|
192
|
+
|
193
|
+
extra_rdoc_files:
|
195
194
|
- LICENSE.txt
|
196
195
|
- README.rdoc
|
197
|
-
files:
|
196
|
+
files:
|
198
197
|
- .document
|
199
198
|
- .irbrc
|
200
199
|
- .rspec
|
@@ -215,6 +214,7 @@ files:
|
|
215
214
|
- examples/cache_aspect.rb
|
216
215
|
- examples/design_by_contract.rb
|
217
216
|
- examples/exception_handler.rb
|
217
|
+
- examples/exception_handler2.rb
|
218
218
|
- examples/implicit_method_option_test.rb
|
219
219
|
- examples/logging_aspect.rb
|
220
220
|
- examples/retry_aspect.rb
|
@@ -257,32 +257,39 @@ files:
|
|
257
257
|
- spec/unit/method_matcher_spec.rb
|
258
258
|
- spec/unit/raw_spec.rb
|
259
259
|
- spec/unit/special_chars_spec.rb
|
260
|
+
has_rdoc: true
|
260
261
|
homepage: http://github.com/gcao/aspector
|
261
|
-
licenses:
|
262
|
+
licenses:
|
262
263
|
- MIT
|
263
264
|
post_install_message:
|
264
265
|
rdoc_options: []
|
265
|
-
|
266
|
+
|
267
|
+
require_paths:
|
266
268
|
- lib
|
267
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
269
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
268
270
|
none: false
|
269
|
-
requirements:
|
270
|
-
- -
|
271
|
-
- !ruby/object:Gem::Version
|
272
|
-
|
273
|
-
segments:
|
271
|
+
requirements:
|
272
|
+
- - ">="
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
hash: 3
|
275
|
+
segments:
|
274
276
|
- 0
|
275
|
-
|
276
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
|
+
version: "0"
|
278
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
279
|
none: false
|
278
|
-
requirements:
|
279
|
-
- -
|
280
|
-
- !ruby/object:Gem::Version
|
281
|
-
|
280
|
+
requirements:
|
281
|
+
- - ">="
|
282
|
+
- !ruby/object:Gem::Version
|
283
|
+
hash: 3
|
284
|
+
segments:
|
285
|
+
- 0
|
286
|
+
version: "0"
|
282
287
|
requirements: []
|
288
|
+
|
283
289
|
rubyforge_project:
|
284
|
-
rubygems_version: 1.
|
290
|
+
rubygems_version: 1.6.2
|
285
291
|
signing_key:
|
286
292
|
specification_version: 3
|
287
293
|
summary: Aspect Oriented Ruby Programming
|
288
294
|
test_files: []
|
295
|
+
|