ruby-contract 0.1.1
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/COPYING +56 -0
- data/Manifest +85 -0
- data/README +32 -0
- data/TODO +83 -0
- data/doc/classes/Contract.html +599 -0
- data/doc/classes/Contract/Check.html +229 -0
- data/doc/classes/Contract/Check/All.html +172 -0
- data/doc/classes/Contract/Check/Any.html +172 -0
- data/doc/classes/Contract/Check/Block.html +172 -0
- data/doc/classes/Contract/Check/None.html +173 -0
- data/doc/classes/Contract/Check/Quack.html +172 -0
- data/doc/classes/Contract/ContractError.html +151 -0
- data/doc/classes/Contract/ContractException.html +162 -0
- data/doc/classes/Contract/ContractMismatch.html +134 -0
- data/doc/classes/Kernel.html +256 -0
- data/doc/classes/Method.html +135 -0
- data/doc/classes/MethodSignatureMixin.html +208 -0
- data/doc/classes/Module.html +526 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +14 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +14 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_2.dot +14 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/f_3.dot +112 -0
- data/doc/dot/f_3.png +0 -0
- data/doc/dot/f_4.dot +62 -0
- data/doc/dot/f_4.png +0 -0
- data/doc/dot/f_5.dot +62 -0
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +224 -0
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_6_0.dot +24 -0
- data/doc/dot/f_6_0.png +0 -0
- data/doc/dot/f_6_1.dot +24 -0
- data/doc/dot/f_6_1.png +0 -0
- data/doc/dot/f_7.dot +62 -0
- data/doc/dot/f_7.png +0 -0
- data/doc/files/COPYING.html +168 -0
- data/doc/files/README.html +146 -0
- data/doc/files/TODO.html +240 -0
- data/doc/files/lib/contract/assertions_rb.html +118 -0
- data/doc/files/lib/contract/exception_rb.html +125 -0
- data/doc/files/lib/contract/integration_rb.html +130 -0
- data/doc/files/lib/contract/overrides_rb.html +118 -0
- data/doc/files/lib/contract_rb.html +127 -0
- data/doc/fr_class_index.html +40 -0
- data/doc/fr_file_index.html +34 -0
- data/doc/fr_method_index.html +45 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/contract.rb +146 -0
- data/lib/contract/assertions.rb +42 -0
- data/lib/contract/exception.rb +95 -0
- data/lib/contract/integration.rb +664 -0
- data/lib/contract/overrides.rb +41 -0
- data/setup.rb +1360 -0
- data/test/coverage/_-lib-contract-assertions_rb.html +526 -0
- data/test/coverage/_-lib-contract-exception_rb.html +632 -0
- data/test/coverage/_-lib-contract-integration_rb.html +1450 -0
- data/test/coverage/_-lib-contract-overrides_rb.html +524 -0
- data/test/coverage/_-lib-contract_rb.html +724 -0
- data/test/coverage/__-lib-contract-assertions_rb.html +484 -0
- data/test/coverage/__-lib-contract-exception_rb.html +537 -0
- data/test/coverage/__-lib-contract-integration_rb.html +946 -0
- data/test/coverage/__-lib-contract-overrides_rb.html +483 -0
- data/test/coverage/__-lib-contract_rb.html +583 -0
- data/test/coverage/index.html +93 -0
- data/test/tc_all.rb +8 -0
- data/test/tc_contract.rb +109 -0
- data/test/tc_exception.rb +43 -0
- data/test/tc_integration.rb +357 -0
- metadata +136 -0
@@ -0,0 +1,229 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Contract::Check</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Contract::Check</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/contract/integration_rb.html">
|
59
|
+
lib/contract/integration.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
<div id="diagram">
|
75
|
+
<map id="map" name="map">
|
76
|
+
<area shape="RECT" coords="33,117,105,165" href="../Method.html" alt="Method" title="Method">
|
77
|
+
<area shape="RECT" coords="259,117,331,165" href="../Contract.html" alt="Contract" title="Contract">
|
78
|
+
<area shape="RECT" coords="393,21,465,69" href="../Module.html" alt="Module" title="Module">
|
79
|
+
<area shape="RECT" coords="515,21,621,69" href="../UnboundMethod.html" alt="UnboundMethod" title="UnboundMethod">
|
80
|
+
<area shape="RECT" coords="355,117,488,165" href="Check/Any.html" alt="Contract::Check::Any" title="Contract::Check::Any">
|
81
|
+
<area shape="RECT" coords="512,117,635,165" href="Check/All.html" alt="Contract::Check::All" title="Contract::Check::All">
|
82
|
+
<area shape="RECT" coords="659,117,795,165" href="Check/None.html" alt="Contract::Check::None" title="Contract::Check::None">
|
83
|
+
<area shape="RECT" coords="819,117,957,165" href="Check/Block.html" alt="Contract::Check::Block" title="Contract::Check::Block">
|
84
|
+
<area shape="RECT" coords="659,21,795,69" href="Check/Base.html" alt="Contract::Check::Base" title="Contract::Check::Base">
|
85
|
+
<area shape="RECT" coords="981,117,1123,165" href="Check/Quack.html" alt="Contract::Check::Quack" title="Contract::Check::Quack">
|
86
|
+
<area shape="RECT" coords="7,17,132,61" href="../MethodSignatureMixin.html" alt="MethodSignatureMixin" title="MethodSignatureMixin">
|
87
|
+
<area shape="RECT" coords="127,17,220,61" href="../Kernel.html" alt="Kernel" title="Kernel">
|
88
|
+
</map>
|
89
|
+
<img src="../../dot/f_6.png" usemap="#map" border=0 alt="lib/contract/integration.rb">
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div id="description">
|
93
|
+
<p>
|
94
|
+
Implements checks that can for example be used in <a
|
95
|
+
href="../Module.html#M000015">Module#signature</a> specifications. They are
|
96
|
+
implemented simply by overriding the === case equality operator. They can
|
97
|
+
also be nested like this:
|
98
|
+
</p>
|
99
|
+
<pre>
|
100
|
+
# Matches something that is an Enumerable and that responds to
|
101
|
+
# either :to_ary or :to_a.
|
102
|
+
signature :x, Contract::Check::All[
|
103
|
+
Enumerable,
|
104
|
+
Contract::Check::Any[
|
105
|
+
Contract::Check::Quack[:to_a],
|
106
|
+
Contract::Check::Quack[:to_ary]
|
107
|
+
]
|
108
|
+
]
|
109
|
+
</pre>
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div id="method-list">
|
117
|
+
<h3 class="section-bar">Methods</h3>
|
118
|
+
|
119
|
+
<div class="name-list">
|
120
|
+
<a href="#M000009">block</a>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
|
126
|
+
|
127
|
+
<!-- if includes -->
|
128
|
+
|
129
|
+
<div id="section">
|
130
|
+
|
131
|
+
<div id="class-list">
|
132
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
133
|
+
|
134
|
+
Class <a href="Check/All.html" class="link">Contract::Check::All</a><br />
|
135
|
+
Class <a href="Check/Any.html" class="link">Contract::Check::Any</a><br />
|
136
|
+
Class <a href="Check/Block.html" class="link">Contract::Check::Block</a><br />
|
137
|
+
Class <a href="Check/None.html" class="link">Contract::Check::None</a><br />
|
138
|
+
Class <a href="Check/Quack.html" class="link">Contract::Check::Quack</a><br />
|
139
|
+
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div id="constants-list">
|
143
|
+
<h3 class="section-bar">Constants</h3>
|
144
|
+
|
145
|
+
<div class="name-list">
|
146
|
+
<table summary="Constants">
|
147
|
+
<tr class="top-aligned-row context-row">
|
148
|
+
<td class="context-item-name">And</td>
|
149
|
+
<td>=</td>
|
150
|
+
<td class="context-item-value">All unless defined?(And)</td>
|
151
|
+
<td width="3em"> </td>
|
152
|
+
<td class="context-item-desc">
|
153
|
+
Alias for <a href="Check/All.html">Contract::Check::All</a>
|
154
|
+
|
155
|
+
</td>
|
156
|
+
</tr>
|
157
|
+
<tr class="top-aligned-row context-row">
|
158
|
+
<td class="context-item-name">Or</td>
|
159
|
+
<td>=</td>
|
160
|
+
<td class="context-item-value">Any unless defined?(Or)</td>
|
161
|
+
<td width="3em"> </td>
|
162
|
+
<td class="context-item-desc">
|
163
|
+
Alias for <a href="Check/Any.html">Contract::Check::Any</a>
|
164
|
+
|
165
|
+
</td>
|
166
|
+
</tr>
|
167
|
+
<tr class="top-aligned-row context-row">
|
168
|
+
<td class="context-item-name">Not</td>
|
169
|
+
<td>=</td>
|
170
|
+
<td class="context-item-value">None unless defined?(Not)</td>
|
171
|
+
<td width="3em"> </td>
|
172
|
+
<td class="context-item-desc">
|
173
|
+
Alias for <a href="Check/None.html">Contract::Check::None</a>
|
174
|
+
|
175
|
+
</td>
|
176
|
+
</tr>
|
177
|
+
</table>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<!-- if method_list -->
|
187
|
+
<div id="methods">
|
188
|
+
<h3 class="section-bar">Public Class methods</h3>
|
189
|
+
|
190
|
+
<div id="method-M000009" class="method-detail">
|
191
|
+
<a name="M000009"></a>
|
192
|
+
|
193
|
+
<div class="method-heading">
|
194
|
+
<a href="#M000009" class="method-signature">
|
195
|
+
<span class="method-name">block</span><span class="method-args">() {|arg| ...}</span>
|
196
|
+
</a>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div class="method-description">
|
200
|
+
<p>
|
201
|
+
Short-cut for creating a <a
|
202
|
+
href="Check/Block.html">Contract::Check::Block</a>.
|
203
|
+
</p>
|
204
|
+
<p><a class="source-toggle" href="#"
|
205
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
206
|
+
<div class="method-source-code" id="M000009-source">
|
207
|
+
<pre>
|
208
|
+
<span class="ruby-comment cmt"># File lib/contract/integration.rb, line 42</span>
|
209
|
+
42: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">block</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-comment cmt"># :yields: arg</span>
|
210
|
+
43: <span class="ruby-constant">Block</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
211
|
+
44: <span class="ruby-keyword kw">end</span>
|
212
|
+
</pre>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
|
218
|
+
</div>
|
219
|
+
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
<div id="validator-badges">
|
225
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
</body>
|
229
|
+
</html>
|
@@ -0,0 +1,172 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Contract::Check::All</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Contract::Check::All</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/contract/integration_rb.html">
|
59
|
+
lib/contract/integration.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Base
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
<div id="diagram">
|
81
|
+
<map id="map" name="map">
|
82
|
+
<area shape="RECT" coords="33,117,105,165" href="../../Method.html" alt="Method" title="Method">
|
83
|
+
<area shape="RECT" coords="259,117,331,165" href="../../Contract.html" alt="Contract" title="Contract">
|
84
|
+
<area shape="RECT" coords="393,21,465,69" href="../../Module.html" alt="Module" title="Module">
|
85
|
+
<area shape="RECT" coords="515,21,621,69" href="../../UnboundMethod.html" alt="UnboundMethod" title="UnboundMethod">
|
86
|
+
<area shape="RECT" coords="355,117,488,165" href="Any.html" alt="Contract::Check::Any" title="Contract::Check::Any">
|
87
|
+
<area shape="RECT" coords="512,117,635,165" href="All.html" alt="Contract::Check::All" title="Contract::Check::All">
|
88
|
+
<area shape="RECT" coords="659,117,795,165" href="None.html" alt="Contract::Check::None" title="Contract::Check::None">
|
89
|
+
<area shape="RECT" coords="819,117,957,165" href="Block.html" alt="Contract::Check::Block" title="Contract::Check::Block">
|
90
|
+
<area shape="RECT" coords="659,21,795,69" href="Base.html" alt="Contract::Check::Base" title="Contract::Check::Base">
|
91
|
+
<area shape="RECT" coords="981,117,1123,165" href="Quack.html" alt="Contract::Check::Quack" title="Contract::Check::Quack">
|
92
|
+
<area shape="RECT" coords="7,17,132,61" href="../../MethodSignatureMixin.html" alt="MethodSignatureMixin" title="MethodSignatureMixin">
|
93
|
+
<area shape="RECT" coords="127,17,220,61" href="../../Kernel.html" alt="Kernel" title="Kernel">
|
94
|
+
</map>
|
95
|
+
<img src="../../../dot/f_6.png" usemap="#map" border=0 alt="lib/contract/integration.rb">
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div id="description">
|
99
|
+
<p>
|
100
|
+
Checks that all the specified conditions match. Example:
|
101
|
+
</p>
|
102
|
+
<pre>
|
103
|
+
signature :x, Contract::Check::All[Array, Enumerable]
|
104
|
+
</pre>
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="method-list">
|
112
|
+
<h3 class="section-bar">Methods</h3>
|
113
|
+
|
114
|
+
<div class="name-list">
|
115
|
+
<a href="#M000011">===</a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
<!-- if includes -->
|
123
|
+
|
124
|
+
<div id="section">
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- if method_list -->
|
134
|
+
<div id="methods">
|
135
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
136
|
+
|
137
|
+
<div id="method-M000011" class="method-detail">
|
138
|
+
<a name="M000011"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="#M000011" class="method-signature">
|
142
|
+
<span class="method-name">===</span><span class="method-args">(other)</span>
|
143
|
+
</a>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
<p><a class="source-toggle" href="#"
|
148
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
149
|
+
<div class="method-source-code" id="M000011-source">
|
150
|
+
<pre>
|
151
|
+
<span class="ruby-comment cmt"># File lib/contract/integration.rb, line 59</span>
|
152
|
+
59: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">other</span>)
|
153
|
+
60: <span class="ruby-ivar">@args</span>.<span class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">other</span> }
|
154
|
+
61: <span class="ruby-keyword kw">end</span>
|
155
|
+
</pre>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
167
|
+
<div id="validator-badges">
|
168
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
</body>
|
172
|
+
</html>
|
@@ -0,0 +1,172 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Contract::Check::Any</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Contract::Check::Any</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/contract/integration_rb.html">
|
59
|
+
lib/contract/integration.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Base
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
<div id="diagram">
|
81
|
+
<map id="map" name="map">
|
82
|
+
<area shape="RECT" coords="33,117,105,165" href="../../Method.html" alt="Method" title="Method">
|
83
|
+
<area shape="RECT" coords="259,117,331,165" href="../../Contract.html" alt="Contract" title="Contract">
|
84
|
+
<area shape="RECT" coords="393,21,465,69" href="../../Module.html" alt="Module" title="Module">
|
85
|
+
<area shape="RECT" coords="515,21,621,69" href="../../UnboundMethod.html" alt="UnboundMethod" title="UnboundMethod">
|
86
|
+
<area shape="RECT" coords="355,117,488,165" href="Any.html" alt="Contract::Check::Any" title="Contract::Check::Any">
|
87
|
+
<area shape="RECT" coords="512,117,635,165" href="All.html" alt="Contract::Check::All" title="Contract::Check::All">
|
88
|
+
<area shape="RECT" coords="659,117,795,165" href="None.html" alt="Contract::Check::None" title="Contract::Check::None">
|
89
|
+
<area shape="RECT" coords="819,117,957,165" href="Block.html" alt="Contract::Check::Block" title="Contract::Check::Block">
|
90
|
+
<area shape="RECT" coords="659,21,795,69" href="Base.html" alt="Contract::Check::Base" title="Contract::Check::Base">
|
91
|
+
<area shape="RECT" coords="981,117,1123,165" href="Quack.html" alt="Contract::Check::Quack" title="Contract::Check::Quack">
|
92
|
+
<area shape="RECT" coords="7,17,132,61" href="../../MethodSignatureMixin.html" alt="MethodSignatureMixin" title="MethodSignatureMixin">
|
93
|
+
<area shape="RECT" coords="127,17,220,61" href="../../Kernel.html" alt="Kernel" title="Kernel">
|
94
|
+
</map>
|
95
|
+
<img src="../../../dot/f_6.png" usemap="#map" border=0 alt="lib/contract/integration.rb">
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div id="description">
|
99
|
+
<p>
|
100
|
+
Checks that at least one of the specified conditions match. Example:
|
101
|
+
</p>
|
102
|
+
<pre>
|
103
|
+
signature :x, Contract::Check::Any[String, Symbol]
|
104
|
+
</pre>
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="method-list">
|
112
|
+
<h3 class="section-bar">Methods</h3>
|
113
|
+
|
114
|
+
<div class="name-list">
|
115
|
+
<a href="#M000010">===</a>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
<!-- if includes -->
|
123
|
+
|
124
|
+
<div id="section">
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<!-- if method_list -->
|
134
|
+
<div id="methods">
|
135
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
136
|
+
|
137
|
+
<div id="method-M000010" class="method-detail">
|
138
|
+
<a name="M000010"></a>
|
139
|
+
|
140
|
+
<div class="method-heading">
|
141
|
+
<a href="#M000010" class="method-signature">
|
142
|
+
<span class="method-name">===</span><span class="method-args">(other)</span>
|
143
|
+
</a>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
<p><a class="source-toggle" href="#"
|
148
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
149
|
+
<div class="method-source-code" id="M000010-source">
|
150
|
+
<pre>
|
151
|
+
<span class="ruby-comment cmt"># File lib/contract/integration.rb, line 70</span>
|
152
|
+
70: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">other</span>)
|
153
|
+
71: <span class="ruby-ivar">@args</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-identifier">arg</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">other</span> }
|
154
|
+
72: <span class="ruby-keyword kw">end</span>
|
155
|
+
</pre>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
|
163
|
+
|
164
|
+
</div>
|
165
|
+
|
166
|
+
|
167
|
+
<div id="validator-badges">
|
168
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
</body>
|
172
|
+
</html>
|