Class: QED::Applique
- Inherits:
-
Module
- Object
- Module
- QED::Applique
- Defined in:
- lib/qed/applique.rb
Overview
The Applique is the environment of libraries required by and the rules to apply to demonstrandum. The applique is defined by a set of scripts located in the applique
directory of the upper-most test directory relative to the tests run and below the root of a project. All applique scripts are loaded at the start of a test session. Thus all demos belong to one and only one applique, and all the scripts in an applique must be compatible/consistant. For two demos to have separate applique they must be kept in separate directores.
Instance Method Summary collapse
- #__advice__ ⇒ Object
-
#After(type = :code, &procedure) ⇒ Object
After advice.
-
#Before(type = :code, &procedure) ⇒ Object
Before advice.
-
#const_missing(name) ⇒ Object
Redirect missing constants to Object class to simulate TOPLEVEL.
-
#initialize ⇒ Applique
constructor
A new instance of Applique.
- #initialize_copy(other) ⇒ Object
-
#When(*patterns, &procedure) ⇒ Object
Because patterns are mathced against HTML documents HTML special charaters <, > and & should not be used.
Constructor Details
Instance Method Details
#__advice__ ⇒ Object
39 40 41 |
# File 'lib/qed/applique.rb', line 39 def __advice__ @__advice__ end |
#After(type = :code, &procedure) ⇒ Object
After advice.
60 61 62 |
# File 'lib/qed/applique.rb', line 60 def After(type=:code, &procedure) __advice__.events.add(:"after_#{type}", &procedure) end |
#Before(type = :code, &procedure) ⇒ Object
Before advice.
55 56 57 |
# File 'lib/qed/applique.rb', line 55 def Before(type=:code, &procedure) __advice__.events.add(:"before_#{type}", &procedure) end |
#const_missing(name) ⇒ Object
Redirect missing constants to Object class to simulate TOPLEVEL.
TODO: Clean backtrace when constant is not found.
34 35 36 |
# File 'lib/qed/applique.rb', line 34 def const_missing(name) Object.const_get(name) end |
#initialize_copy(other) ⇒ Object
26 27 28 |
# File 'lib/qed/applique.rb', line 26 def initialize_copy(other) @__advice__ = other.__advice__.dup end |
#When(*patterns, &procedure) ⇒ Object
Because patterns are mathced against HTML documents HTML special charaters <, > and & should not be used.
46 47 48 49 50 51 52 |
# File 'lib/qed/applique.rb', line 46 def When(*patterns, &procedure) if patterns.size == 1 && Symbol === patterns.first __advice__.events.add(:"#{patterns.first}", &procedure) else __advice__.patterns.add(patterns, &procedure) end end |