handshake 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +4 -2
- data/README.txt +110 -0
- data/Rakefile +2 -1
- data/lib/handshake/block_contract.rb +53 -0
- data/lib/handshake/clause_methods.rb +170 -0
- data/lib/handshake/proxy_self.rb +19 -0
- data/lib/handshake/version.rb +1 -1
- data/lib/handshake.rb +589 -0
- data/test/tc_handshake.rb +54 -0
- metadata +6 -4
- data/README +0 -33
- data/lib/handshake/handshake.rb +0 -737
data/README
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
== Handshake
|
2
|
-
|
3
|
-
Handshake is an informal design-by-contract system written in pure Ruby.
|
4
|
-
It's intended to allow Ruby developers to apply simple, clear constraints
|
5
|
-
to their methods and classes. Handshake is written by Brian Guthrie
|
6
|
-
(btguthrie@gmail.com) and lives at http://handshake.rubyforge.org.
|
7
|
-
|
8
|
-
Here's an example of Handshake in action:
|
9
|
-
|
10
|
-
class NonEmptyArray < Array
|
11
|
-
include Handshake
|
12
|
-
invariant { not empty? }
|
13
|
-
end
|
14
|
-
|
15
|
-
class NonEmptyStringArray < NonEmptyArray
|
16
|
-
contract :initialize, [[ String ]] => anything
|
17
|
-
contract :<<, String => self
|
18
|
-
contract :+, many?(String) => self
|
19
|
-
end
|
20
|
-
|
21
|
-
Handshake can also define pre- and post-conditions on your methods.
|
22
|
-
|
23
|
-
class Foo
|
24
|
-
before do
|
25
|
-
assert( not @widget.nil? )
|
26
|
-
end
|
27
|
-
def something_that_requires_widget
|
28
|
-
...
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
See Handshake::ClassMethods for more documentation on exact syntax and
|
33
|
-
capabilities.
|