qed 2.6.3 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby +4 -3
- data/.yardopts +3 -0
- data/HISTORY.rdoc +71 -35
- data/README.rdoc +9 -10
- data/bin/qed +1 -1
- data/bin/qedoc +2 -1
- data/lib/qed.rb +2 -5
- data/lib/qed.yml +4 -3
- data/lib/qed/applique.rb +57 -24
- data/lib/qed/cli.rb +8 -0
- data/lib/qed/cli/qed.rb +124 -0
- data/lib/qed/demo.rb +35 -39
- data/lib/qed/document.rb +5 -3
- data/lib/qed/document/template.rhtml +1 -0
- data/lib/qed/evaluator.rb +227 -199
- data/lib/qed/parser.rb +60 -282
- data/lib/qed/reporter/abstract.rb +54 -58
- data/lib/qed/reporter/dotprogress.rb +6 -4
- data/lib/qed/reporter/html.rb +112 -31
- data/lib/qed/reporter/tapy.rb +95 -125
- data/lib/qed/reporter/verbatim.rb +80 -38
- data/lib/qed/scope.rb +35 -48
- data/lib/qed/session.rb +35 -140
- data/lib/qed/settings.rb +104 -67
- data/lib/qed/step.rb +237 -0
- data/{spec → qed}/01_demos.rdoc +0 -0
- data/{spec → qed}/02_advice.rdoc +18 -7
- data/qed/03_helpers.rdoc +44 -0
- data/{spec → qed}/04_samples.rdoc +4 -4
- data/{spec → qed}/05_quote.rdoc +3 -3
- data/{spec → qed}/07_toplevel.rdoc +0 -0
- data/{spec → qed}/08_cross_script.rdoc +0 -0
- data/{spec → qed}/09_cross_script.rdoc +0 -0
- data/{spec → qed}/10_constant_lookup.rdoc +2 -2
- data/qed/11_embedded_rules.rdoc +46 -0
- data/{test/integration/topcode.rdoc → qed/99_issues/02_topcode.rdoc} +0 -0
- data/{spec → qed}/applique/constant.rb +0 -0
- data/{spec → qed}/applique/env.rb +0 -0
- data/{spec → qed}/applique/fileutils.rb +0 -0
- data/{spec → qed}/applique/markup.rb +0 -0
- data/{spec → qed}/applique/toplevel.rb +0 -0
- data/{spec → qed}/helpers/advice.rb +6 -7
- data/{spec → qed}/helpers/toplevel.rb +0 -0
- data/{spec → qed}/samples/data.txt +0 -0
- data/{spec → qed}/samples/table.yml +0 -0
- metadata +44 -39
- data/LICENSE.rdoc +0 -31
- data/SPECSHEET.rdoc +0 -456
- data/lib/qed/advice.rb +0 -158
- data/lib/qed/reporter/bullet.rb +0 -91
- data/lib/qed/reporter/dtrace.rb +0 -67
- data/lib/yard-qed.rb +0 -1
- data/spec/03_helpers.rdoc +0 -43
- data/spec/applique/quote.rb +0 -4
- data/spec/helpers/sample.rb +0 -4
data/.ruby
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
source:
|
3
|
-
-
|
3
|
+
- var
|
4
4
|
authors:
|
5
5
|
- name: Trans
|
6
6
|
email: transfire@gmail.com
|
@@ -16,6 +16,7 @@ requirements:
|
|
16
16
|
version: 2.8+
|
17
17
|
- name: ae
|
18
18
|
version: 1.7+
|
19
|
+
- name: confection
|
19
20
|
- name: detroit
|
20
21
|
groups:
|
21
22
|
- build
|
@@ -38,9 +39,9 @@ revision: 0
|
|
38
39
|
created: '2006-12-16'
|
39
40
|
summary: Quod Erat Demonstrandum
|
40
41
|
title: QED
|
41
|
-
version: 2.
|
42
|
+
version: 2.7.0
|
42
43
|
name: qed
|
43
44
|
description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
|
44
45
|
|
45
46
|
utilizing Literate Programming techniques.'
|
46
|
-
date: '2011-
|
47
|
+
date: '2011-11-20'
|
data/.yardopts
CHANGED
data/HISTORY.rdoc
CHANGED
@@ -1,6 +1,42 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
-
== 2.
|
3
|
+
== 2.7.0 | 2011-11-18
|
4
|
+
|
5
|
+
The focus of this release is a much improved underlying API, including
|
6
|
+
a better event model and the application of SOLID principles to really
|
7
|
+
get the code in good shape. In most respects the changes will not effect
|
8
|
+
QED documents --at most some event signals may need to be adjusted, if
|
9
|
+
an old applique happened to use them.
|
10
|
+
|
11
|
+
Beyond the underlying code, some other important changes have been made.
|
12
|
+
|
13
|
+
Configuration is now handled by the `confection` gem. Simply add a `qed`
|
14
|
+
section to your `Confile`. In it you can add `profile` blocks. See QED
|
15
|
+
project's own `.confile` for an example.
|
16
|
+
|
17
|
+
A new notation for captures has been added. Captures can now be written
|
18
|
+
as `/(\S+)/` and non-capture expressions as `/?:\S+/`. The old
|
19
|
+
parenthetical notation still works. Strings arguments may also add `...`
|
20
|
+
to split the string into two match arguments without actually having
|
21
|
+
to pass two arguments.
|
22
|
+
|
23
|
+
The change most likely to effect old demonstrandum, is the deprecation
|
24
|
+
of `...` plain text marker. Be sure to make sure your demos use `:` instead.
|
25
|
+
|
26
|
+
Changes:
|
27
|
+
|
28
|
+
* Deprecate use of '...' as a plain text example indicator.
|
29
|
+
* When string arguments can use '...' to split the match.
|
30
|
+
* Applique files can now be demo documents too.
|
31
|
+
* Use confection gem for configuration.
|
32
|
+
* Must use `-f` option to use (most) alternative reporters.
|
33
|
+
* Show full backtrace in (most) reporters.
|
34
|
+
* Overhaul evaluator using better signal names.
|
35
|
+
* Underlying observer API redesigned (effects reporters).
|
36
|
+
* Rework API taking SOLID principles into consideration.
|
37
|
+
|
38
|
+
|
39
|
+
== 2.6.3 | 2011-10-23
|
4
40
|
|
5
41
|
Fixed output status. When tests fail or error the `qed`
|
6
42
|
command with exit -1 instead to 0. Also, the default
|
@@ -13,7 +49,7 @@ Changes:
|
|
13
49
|
* Fix default spec location to only use one or the other.
|
14
50
|
|
15
51
|
|
16
|
-
== 2.6.1
|
52
|
+
== 2.6.1 | 2011-07-02
|
17
53
|
|
18
54
|
A friend suggested QED default the load path to lib and
|
19
55
|
automatically look for QED demos in default locations
|
@@ -24,18 +60,18 @@ Changes:
|
|
24
60
|
|
25
61
|
* Default loadpath option to lib/.
|
26
62
|
* Default files to markup files in spec/, demo/ and qed/.
|
27
|
-
* Fix website links (you might
|
63
|
+
* Fix website links (you might actually find things now).
|
28
64
|
|
29
65
|
|
30
|
-
== 2.6.0
|
66
|
+
== 2.6.0 | 2011-07-01
|
31
67
|
|
32
|
-
|
68
|
+
This release fixes some issues with reporters, further refines
|
33
69
|
their output and adds the start of a new reporter called dtrace.
|
34
70
|
Also the Table and Data macros have been updated. Table can now
|
35
71
|
handle a YAML stream with the :stream option, and Data no long runs
|
36
|
-
the text through YAML.load
|
72
|
+
the text through YAML.load when the file name ends in .yml or .yaml,
|
37
73
|
In other words it's for raw fixture data. Finally the documentation
|
38
|
-
tool has been improved
|
74
|
+
tool has been improved to simplify HTML generation and also add a
|
39
75
|
format option for creating a simple plain text merging instead.
|
40
76
|
|
41
77
|
Changes:
|
@@ -50,10 +86,10 @@ Changes:
|
|
50
86
|
* HTML output is single file, jquery comes from CDNJ.
|
51
87
|
|
52
88
|
|
53
|
-
== 2.5.2
|
89
|
+
== 2.5.2 | 2011-06-26
|
54
90
|
|
55
91
|
This release focuses on reporter improvements. Better trace
|
56
|
-
information is now displayed, and the max
|
92
|
+
information is now displayed, and the max number of backtrace
|
57
93
|
lines can be set with the -t option, or $trace environment
|
58
94
|
variable.
|
59
95
|
|
@@ -64,9 +100,9 @@ Changes:
|
|
64
100
|
* Added TAP-Y reporter.
|
65
101
|
|
66
102
|
|
67
|
-
== 2.5.1
|
103
|
+
== 2.5.1 | 2011-06-07
|
68
104
|
|
69
|
-
This release makes a number adjustments and fixes one
|
105
|
+
This release makes a number adjustments and fixes one major issue
|
70
106
|
with the way the latest AE library counts assertions.
|
71
107
|
|
72
108
|
Changes:
|
@@ -76,11 +112,11 @@ Changes:
|
|
76
112
|
* Backtrace filter omits references to AE library.
|
77
113
|
|
78
114
|
|
79
|
-
== 2.5.0
|
115
|
+
== 2.5.0 | 2010-11-04
|
80
116
|
|
81
117
|
The latest release of QED improves on applique loading, such that each
|
82
118
|
demonstrandum gets it's own localized set. The CLI has also been modified
|
83
|
-
so that there is no longer a
|
119
|
+
so that there is no longer a default location, the directory or files to run
|
84
120
|
must be specified.
|
85
121
|
|
86
122
|
Changes:
|
@@ -92,10 +128,10 @@ Changes:
|
|
92
128
|
* CLI requires files be specified.
|
93
129
|
|
94
130
|
|
95
|
-
== 2.4.0
|
131
|
+
== 2.4.0 | 2010-09-02
|
96
132
|
|
97
133
|
All engines go! QED has not been tested against 1.8.6, 1.8.7 and 1.9.2.
|
98
|
-
Underthehood steps are not organized in
|
134
|
+
Underthehood steps are not organized in doubly-linked lists, which makes
|
99
135
|
them much more robust and flexible. This release also improves scoping,
|
100
136
|
test counts, and inline documentation parsing.
|
101
137
|
|
@@ -107,18 +143,18 @@ Changes:
|
|
107
143
|
* Scope is extended by and includes applique.
|
108
144
|
|
109
145
|
|
110
|
-
== 2.3.0
|
146
|
+
== 2.3.0 | 2010-07-14
|
111
147
|
|
112
148
|
Bug to the scurry! QED has broken through the code/document ceiling and
|
113
|
-
is cracking
|
114
|
-
Roach-Be-Gone this is! What's that you say? I will
|
149
|
+
is cracking exoskeletons all the way to the bank. A proverbial can of
|
150
|
+
Roach-Be-Gone this is! What's that you say? I will explain. QED can now
|
115
151
|
run directly against code comments. Simply slip the qed command the -c
|
116
|
-
option and feed it some ruby scripts, and presto watch you
|
152
|
+
option and feed it some ruby scripts, and presto watch you comments
|
117
153
|
fail ;) I think you can figure out what to do next.
|
118
154
|
|
119
155
|
In addition to this coolness QED has been improved under the floor
|
120
156
|
boards as well. The parser, which is much faster, now blocks commentary
|
121
|
-
paragraphs and code examples
|
157
|
+
paragraphs and code examples together in one-to-one pairings. Not only
|
122
158
|
does this clean-up the code, but it opens up the potential for Around
|
123
159
|
advice in a future version.
|
124
160
|
|
@@ -130,7 +166,7 @@ Changes:
|
|
130
166
|
* Now distributed under the more permissive Apache 2.0 license.
|
131
167
|
|
132
168
|
|
133
|
-
== 2.2.2
|
169
|
+
== 2.2.2 | 2010-06-21
|
134
170
|
|
135
171
|
An issue was reported in which the a code block at the very
|
136
172
|
top of a demo was being ignored. This release fixes this issue
|
@@ -146,7 +182,7 @@ Changes:
|
|
146
182
|
* Added -R option to run demos relative to project root.
|
147
183
|
|
148
184
|
|
149
|
-
== 2.2.1
|
185
|
+
== 2.2.1 | 2010-06-20
|
150
186
|
|
151
187
|
Remove dependencies to Tilt and Nokogiri. Should have
|
152
188
|
done this in last release but alas --there is so
|
@@ -158,13 +194,13 @@ Changes:
|
|
158
194
|
* Reduce Advice to a single class.
|
159
195
|
|
160
196
|
|
161
|
-
== 2.2.0
|
197
|
+
== 2.2.0 | 2010-06-19
|
162
198
|
|
163
199
|
This release returns to a text-based evaluator, rather
|
164
200
|
then use HTML. Processing HTML proved to have too many
|
165
201
|
edge cases to be effective --both in implementation
|
166
202
|
and in end-usage. So to remedy the situation QED has
|
167
|
-
return to
|
203
|
+
return to supporting simple markup formats such as
|
168
204
|
RDoc and Markup.
|
169
205
|
|
170
206
|
This release also adds multi-pattern advice. Instead of
|
@@ -174,14 +210,14 @@ descriptions without restoring to regular expressions.
|
|
174
210
|
|
175
211
|
In addition QED now supports raw text blocks. By ending
|
176
212
|
a description section in ellipsis (...), the subsequent
|
177
|
-
code
|
213
|
+
code section becomes a plain text section and is passed
|
178
214
|
into the argument list of any matching When advice. This
|
179
215
|
makes it easy to scaffold fixture files, for example.
|
180
216
|
|
181
217
|
Finally, this release also refines the evaluation scopes.
|
182
218
|
Where before, a new binding was being created, each was
|
183
219
|
attached to the TOPLEVEL, and therefore not truly isolated
|
184
|
-
on a per-
|
220
|
+
on a per-document basis. To correct, QED now mocks the
|
185
221
|
TOPLEVEL providing a new instance of this mock object for
|
186
222
|
each document.
|
187
223
|
|
@@ -194,7 +230,7 @@ Changes:
|
|
194
230
|
* Adjust color support for latest ANSI release.
|
195
231
|
|
196
232
|
|
197
|
-
== 2.1.1
|
233
|
+
== 2.1.1 | 2010-04-08
|
198
234
|
|
199
235
|
Fixed bug introduced in the last version that executed all
|
200
236
|
scripts in a single binding. There needed to be a binding
|
@@ -205,7 +241,7 @@ Changes:
|
|
205
241
|
* Fixed cross-script bug by moving binding instantiation into Script class.
|
206
242
|
|
207
243
|
|
208
|
-
== 2.1.0
|
244
|
+
== 2.1.0 | 2010-04-07
|
209
245
|
|
210
246
|
QED documents are now run in the TOPLEVEL context, rather
|
211
247
|
than in a subclass of Scope. This ensures code runs as
|
@@ -217,7 +253,7 @@ Changes:
|
|
217
253
|
* DomainLanguage module is added to include into TOPLEVEL.
|
218
254
|
|
219
255
|
|
220
|
-
== 2.0.0
|
256
|
+
== 2.0.0 | 2010-03-04
|
221
257
|
|
222
258
|
This is a major new release of QED. All demonstration documents
|
223
259
|
are now converted to HTML via Tilt (http://github.com/tilt) before
|
@@ -233,7 +269,7 @@ Changes:
|
|
233
269
|
* New system of version numbers.
|
234
270
|
|
235
271
|
|
236
|
-
== 1.2.0
|
272
|
+
== 1.2.0 | 2009-12-07
|
237
273
|
|
238
274
|
This release adds a significant new feature, Comment Matchers.
|
239
275
|
These work like Cucumber allowing for background code to
|
@@ -249,11 +285,11 @@ Changes:
|
|
249
285
|
|
250
286
|
* 2 Minor Enhancements
|
251
287
|
|
252
|
-
* Use OptionParser for qed
|
288
|
+
* Use OptionParser for qed executable.
|
253
289
|
* Verbatim reporter is literally verbatim.
|
254
290
|
|
255
291
|
|
256
|
-
== 1.1.1
|
292
|
+
== 1.1.1 | 2009-09-05
|
257
293
|
|
258
294
|
This release
|
259
295
|
|
@@ -270,17 +306,17 @@ Changes:
|
|
270
306
|
* Use latest RDoc version.
|
271
307
|
|
272
308
|
|
273
|
-
== 1.0.0
|
309
|
+
== 1.0.0 | 2009-06-30
|
274
310
|
|
275
311
|
QED has found itself. It took some time to really figure out
|
276
312
|
what this project "was" and how it should best be utilized.
|
277
313
|
This release is the initial release that puts QED in proper
|
278
|
-
|
314
|
+
perspective.
|
279
315
|
|
280
316
|
Changes:
|
281
317
|
|
282
318
|
* 2 Major Enhancement
|
283
319
|
|
284
320
|
* Partial rewrite of a project that was once called "Quarry".
|
285
|
-
* Now
|
321
|
+
* Now use AE for assertions.
|
286
322
|
|
data/README.rdoc
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
= Ruby Q.E.D.
|
2
2
|
|
3
|
+
{Homepage}[http://rubyworks.github.com/qed] |
|
4
|
+
{Development}[http://github.com/rubyworks/qed] |
|
5
|
+
{Mailing list}[http://groups.google.com/group/rubyworks-mailinglist] |
|
6
|
+
|
7
|
+
{<img src="http://travis-ci.org/rubyworks/qed.png" />}[http://travis-ci.org/rubyworks/qed]
|
8
|
+
|
3
9
|
|
4
10
|
== Introduction
|
5
11
|
|
@@ -26,13 +32,6 @@ any level of abstraction, from unit test to systems tests.
|
|
26
32
|
* Documentation tool provides nice output with jQuery-based TOC.
|
27
33
|
|
28
34
|
|
29
|
-
== Resources
|
30
|
-
|
31
|
-
* {Homepage}[http://rubyworks.github.com/qed]
|
32
|
-
* {Mailing list}[http://groups.google.com/group/rubyworks-mailinglist]
|
33
|
-
* {Development}[http://github.com/rubyworks/qed]
|
34
|
-
|
35
|
-
|
36
35
|
== Synopsis
|
37
36
|
|
38
37
|
=== Assertion Syntax
|
@@ -151,12 +150,12 @@ These will be automatically installed when installing QED via RubyGems,
|
|
151
150
|
if they are not already installed.
|
152
151
|
|
153
152
|
|
154
|
-
==
|
153
|
+
== Copyrights
|
155
154
|
|
156
155
|
Q.E.D.
|
157
156
|
|
158
|
-
Copyright (c) 2007 Thomas Sawyer
|
157
|
+
Copyright (c) 2007 Rubyworks, Thomas Sawyer
|
159
158
|
|
160
159
|
BSD 2 Clause License
|
161
160
|
|
162
|
-
See
|
161
|
+
See COPYING.rdoc for details.
|
data/bin/qed
CHANGED
data/bin/qedoc
CHANGED
data/lib/qed.rb
CHANGED
data/lib/qed.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
source:
|
3
|
-
-
|
3
|
+
- var
|
4
4
|
authors:
|
5
5
|
- name: Trans
|
6
6
|
email: transfire@gmail.com
|
@@ -16,6 +16,7 @@ requirements:
|
|
16
16
|
version: 2.8+
|
17
17
|
- name: ae
|
18
18
|
version: 1.7+
|
19
|
+
- name: confection
|
19
20
|
- name: detroit
|
20
21
|
groups:
|
21
22
|
- build
|
@@ -38,9 +39,9 @@ revision: 0
|
|
38
39
|
created: '2006-12-16'
|
39
40
|
summary: Quod Erat Demonstrandum
|
40
41
|
title: QED
|
41
|
-
version: 2.
|
42
|
+
version: 2.7.0
|
42
43
|
name: qed
|
43
44
|
description: ! 'QED (Quality Ensured Demonstrations) is a TDD/BDD framework
|
44
45
|
|
45
46
|
utilizing Literate Programming techniques.'
|
46
|
-
date: '2011-
|
47
|
+
date: '2011-11-20'
|
data/lib/qed/applique.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module QED
|
2
2
|
|
3
|
-
# Applique is a module built per-script from the +applique+
|
3
|
+
# Applique is a module built per-script from the +applique+ directory.
|
4
4
|
# Applique scripts are loaded at the start of a session.
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# *The Applique* is the whole collection of appliques that apply to given
|
7
7
|
# demonstrandum. The applique that apply are the scripts located in the
|
8
8
|
# directory relative to the demonstrandum script and all such directories
|
9
9
|
# above this upto and the project's root directory.
|
10
10
|
#
|
11
11
|
# All scripts in the Applique must be compatible/consistant. For two demos to
|
12
|
-
# have separate applique must be kept in separate
|
12
|
+
# have separate applique they must be kept in separate directories.
|
13
13
|
#
|
14
14
|
class Applique < Module
|
15
15
|
|
@@ -18,22 +18,21 @@ module QED
|
|
18
18
|
@cache ||= {}
|
19
19
|
end
|
20
20
|
|
21
|
-
class << self
|
22
|
-
alias_method :_new, :new
|
23
|
-
end
|
24
|
-
|
25
|
-
# New method caches Applique based-on +file+, if given.
|
26
|
-
#--
|
27
21
|
# TODO: may need to expand file to be absolute path
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
|
23
|
+
# Create new Applique caching instance based-on +file+.
|
24
|
+
#
|
25
|
+
# @param [String] file
|
26
|
+
# The file path to the applique file.
|
27
|
+
#
|
28
|
+
def self.for(file)
|
29
|
+
cache[file] ||= new(file)
|
35
30
|
end
|
36
31
|
|
32
|
+
# Setup new Applique instance.
|
33
|
+
#
|
34
|
+
# @param [String] file
|
35
|
+
# The file path to the applique file.
|
37
36
|
#
|
38
37
|
def initialize(file=nil)
|
39
38
|
super()
|
@@ -44,10 +43,23 @@ module QED
|
|
44
43
|
|
45
44
|
if file
|
46
45
|
@file = file
|
47
|
-
|
46
|
+
case File.extname(file)
|
47
|
+
when '.rb'
|
48
|
+
module_eval(File.read(file), file)
|
49
|
+
else
|
50
|
+
# little bit of a trick here, we create a new demo but manually
|
51
|
+
# set the applique. That way the applique files won't be reloaded.
|
52
|
+
# we then run the demo that applique get loaded.
|
53
|
+
demo = Demo.new(file, :applique=>[self])
|
54
|
+
Evaluator.run(demo, :applique=>true)
|
55
|
+
end
|
48
56
|
end
|
49
57
|
end
|
50
58
|
|
59
|
+
# Duplicate matcher and signal advice when duplicting applique.
|
60
|
+
#
|
61
|
+
# @param [Applique] other
|
62
|
+
# The original applique.
|
51
63
|
#
|
52
64
|
def initialize_copy(other)
|
53
65
|
@__matchers__ = other.__matchers__.dup
|
@@ -61,25 +73,47 @@ module QED
|
|
61
73
|
attr :__signals__
|
62
74
|
|
63
75
|
# Pattern matchers and "upon" events.
|
76
|
+
#
|
77
|
+
# @param [Symbol,Array<String,Regexp>] patterns
|
78
|
+
# Event signal, or list of matches.
|
79
|
+
#
|
80
|
+
# @yield Procedure to run on event.
|
64
81
|
def When(*patterns, &procedure)
|
65
82
|
if patterns.size == 1 && Symbol === patterns.first
|
66
83
|
type = "#{patterns.first}".to_sym
|
67
84
|
@__signals__[type] = procedure
|
68
85
|
#define_method(type, &procedure)
|
69
86
|
else
|
87
|
+
patterns = patterns.map do |p|
|
88
|
+
if String === p
|
89
|
+
p.split('...').map{ |e| e.strip }
|
90
|
+
else
|
91
|
+
p
|
92
|
+
end
|
93
|
+
end.flatten
|
70
94
|
@__matchers__ << [patterns, procedure]
|
71
95
|
end
|
72
96
|
end
|
73
97
|
|
74
98
|
# Before advice.
|
75
|
-
|
99
|
+
#
|
100
|
+
# @param [Symbol] type
|
101
|
+
# Event signal (`:eval`).
|
102
|
+
#
|
103
|
+
# @yield Procedure to run on event.
|
104
|
+
def Before(type=:eval, &procedure)
|
76
105
|
type = "before_#{type}".to_sym
|
77
106
|
@__signals__[type] = procedure
|
78
107
|
#define_method(type, &procedure)
|
79
108
|
end
|
80
109
|
|
81
110
|
# After advice.
|
82
|
-
|
111
|
+
#
|
112
|
+
# @param [Symbol] type
|
113
|
+
# Event signal (`:eval`).
|
114
|
+
#
|
115
|
+
# @yield Procedure to run on event.
|
116
|
+
def After(type=:eval, &procedure)
|
83
117
|
type = "after_#{type}".to_sym
|
84
118
|
@__signals__[type] = procedure
|
85
119
|
#define_method(type, &procedure)
|
@@ -90,7 +124,7 @@ module QED
|
|
90
124
|
# This is useful to transform human readable code examples
|
91
125
|
# into proper exectuable code. For example, say you want to
|
92
126
|
# run shell code, but want to make if look like typical
|
93
|
-
#
|
127
|
+
# shell examples:
|
94
128
|
#
|
95
129
|
# $ cp fixture/a.rb fixture/b.rb
|
96
130
|
#
|
@@ -103,10 +137,10 @@ module QED
|
|
103
137
|
#
|
104
138
|
#end
|
105
139
|
|
106
|
-
#
|
107
|
-
|
140
|
+
# TODO: Clean backtrace when constant is not found ?
|
141
|
+
|
142
|
+
# Redirect missing constants to Object classto simulate TOPLEVEL.
|
108
143
|
#
|
109
|
-
# TODO: Clean backtrace when constant is not found.
|
110
144
|
def const_missing(name)
|
111
145
|
Object.const_get(name)
|
112
146
|
end
|
@@ -114,4 +148,3 @@ module QED
|
|
114
148
|
end
|
115
149
|
|
116
150
|
end
|
117
|
-
|