dirt-core 2.2.3
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/Gemfile +8 -0
- data/Gemfile.lock +46 -0
- data/MIT-LICENSE +23 -0
- data/README +14 -0
- data/doc/BlockValidator.html +272 -0
- data/doc/ClosureValidator.html +276 -0
- data/doc/Dirt.html +158 -0
- data/doc/Dirt/FooBar.html +167 -0
- data/doc/Dirt/HerpZerp.html +161 -0
- data/doc/Dirt/HerpZerp/DerpGerp.html +161 -0
- data/doc/Dirt/HerpZerp/DerpGerp/FooBar.html +167 -0
- data/doc/Dirt/MemoryPersister.html +453 -0
- data/doc/Dirt/MemoryRecord.html +157 -0
- data/doc/Dirt/MissingRecordError.html +157 -0
- data/doc/Dirt/Model.html +320 -0
- data/doc/Dirt/NoPersisterError.html +157 -0
- data/doc/Dirt/Relation.html +338 -0
- data/doc/Dirt/Role.html +345 -0
- data/doc/Dirt/TooManyRecordsError.html +157 -0
- data/doc/Dirt/TransactionError.html +157 -0
- data/doc/ExistenceValidator.html +316 -0
- data/doc/FooBar.html +153 -0
- data/doc/Gemfile.html +131 -0
- data/doc/HerpZerp.html +147 -0
- data/doc/HerpZerp/DerpGerp.html +147 -0
- data/doc/HerpZerp/DerpGerp/FooBar.html +153 -0
- data/doc/Persister.html +311 -0
- data/doc/Persisting.html +413 -0
- data/doc/PresenceValidator.html +281 -0
- data/doc/README.html +132 -0
- data/doc/Role.html +309 -0
- data/doc/Scheduler.html +147 -0
- data/doc/SelfExistenceValidator.html +278 -0
- data/doc/TestPersister.html +411 -0
- data/doc/Validating.html +293 -0
- data/doc/created.rid +18 -0
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +110 -0
- data/doc/js/darkfish.js +155 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +543 -0
- data/doc/table_of_contents.html +203 -0
- data/lib/dirt/bdd/matchers.rb +10 -0
- data/lib/dirt/bdd/persister_spec_helper.rb +213 -0
- data/lib/dirt/bdd/shared_examples.rb +29 -0
- data/lib/dirt/contexts/context.rb +15 -0
- data/lib/dirt/core.rb +36 -0
- data/lib/dirt/errors/missing_record_error.rb +4 -0
- data/lib/dirt/errors/no_persister_error.rb +4 -0
- data/lib/dirt/errors/too_many_records_error.rb +4 -0
- data/lib/dirt/errors/transaction_error.rb +4 -0
- data/lib/dirt/models/model_behaviour.rb +47 -0
- data/lib/dirt/persisters/memory_persister.rb +86 -0
- data/lib/dirt/persisters/persister.rb +54 -0
- data/lib/dirt/persisters/relation.rb +38 -0
- data/lib/dirt/roles/persisting.rb +73 -0
- data/lib/dirt/roles/role.rb +32 -0
- data/lib/dirt/roles/validating.rb +27 -0
- data/lib/dirt/roles/validation/closure_validator.rb +15 -0
- data/lib/dirt/roles/validation/existence_validator.rb +53 -0
- data/lib/dirt/roles/validation/presence_validator.rb +21 -0
- data/lib/dirt/roles/validation/self_existence_validator.rb +18 -0
- data/spec/isolations/closure_validator_spec.rb +57 -0
- data/spec/isolations/context_spec.rb +54 -0
- data/spec/isolations/existence_validator_spec.rb +151 -0
- data/spec/isolations/memory_persister_spec.rb +175 -0
- data/spec/isolations/model_spec.rb +91 -0
- data/spec/isolations/persister_spec.rb +113 -0
- data/spec/isolations/persisting_spec.rb +266 -0
- data/spec/isolations/presence_validator_spec.rb +63 -0
- data/spec/isolations/role_spec.rb +116 -0
- data/spec/isolations/self_existence_validator_spec.rb +64 -0
- data/spec/isolations/spec_helper.rb +26 -0
- data/spec/isolations/validating_spec.rb +88 -0
- metadata +161 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.2.0)
|
5
|
+
i18n (~> 0.7)
|
6
|
+
json (~> 1.7, >= 1.7.7)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
9
|
+
tzinfo (~> 1.1)
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
docile (1.1.5)
|
12
|
+
factory_girl (4.5.0)
|
13
|
+
activesupport (>= 3.0.0)
|
14
|
+
i18n (0.7.0)
|
15
|
+
json (1.8.1)
|
16
|
+
minitest (5.5.0)
|
17
|
+
multi_json (1.10.1)
|
18
|
+
parallel (1.3.3)
|
19
|
+
parallel_tests (1.0.7)
|
20
|
+
parallel
|
21
|
+
rspec (2.14.1)
|
22
|
+
rspec-core (~> 2.14.0)
|
23
|
+
rspec-expectations (~> 2.14.0)
|
24
|
+
rspec-mocks (~> 2.14.0)
|
25
|
+
rspec-core (2.14.8)
|
26
|
+
rspec-expectations (2.14.5)
|
27
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
28
|
+
rspec-mocks (2.14.6)
|
29
|
+
simplecov (0.9.1)
|
30
|
+
docile (~> 1.1.0)
|
31
|
+
multi_json (~> 1.0)
|
32
|
+
simplecov-html (~> 0.8.0)
|
33
|
+
simplecov-html (0.8.0)
|
34
|
+
thread_safe (0.3.4)
|
35
|
+
tzinfo (1.2.2)
|
36
|
+
thread_safe (~> 0.1)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
activesupport
|
43
|
+
factory_girl (~> 4.0)
|
44
|
+
parallel_tests
|
45
|
+
rspec (= 2.14.1)
|
46
|
+
simplecov
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2014 Tenjin Inc.
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
data/README
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
DIRT
|
2
|
+
DCI Implementation in Ruby by Tenjin
|
3
|
+
# :main:README
|
4
|
+
# :title:Dirt
|
5
|
+
# = \Dirt
|
6
|
+
# \Dirt (DCI Implemented in Ruby by Tenjin) is a framework for creating DCI applications.
|
7
|
+
#
|
8
|
+
# Author:: {Tenjin Inc.}[link:http://www.Tenjin.ca]
|
9
|
+
# Copyright:: Copyright (c) 2014
|
10
|
+
# RDOC Generation Command:: <tt>rdoc -main README lib/ README</tt>
|
11
|
+
#
|
12
|
+
# == Usage
|
13
|
+
# To grow things in Dirt, create Contexts for your application, and use Roles to operate on your model objects.
|
14
|
+
# Extend Model to gain helpful methods used in standard Dirt applications.
|
@@ -0,0 +1,272 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class BlockValidator - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/roles/validation/block_validator.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-error_message">#error_message</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-valid-3F">#valid?</a>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
</nav>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div id="project-metadata">
|
85
|
+
<nav id="fileindex-section" class="section project-section">
|
86
|
+
<h3 class="section-header">Pages</h3>
|
87
|
+
|
88
|
+
<ul>
|
89
|
+
|
90
|
+
<li class="file"><a href="./Gemfile.html">Gemfile</a>
|
91
|
+
|
92
|
+
<li class="file"><a href="./README.html">README</a>
|
93
|
+
|
94
|
+
</ul>
|
95
|
+
</nav>
|
96
|
+
|
97
|
+
<nav id="classindex-section" class="section project-section">
|
98
|
+
<h3 class="section-header">Class and Module Index</h3>
|
99
|
+
|
100
|
+
<ul class="link-list">
|
101
|
+
|
102
|
+
<li><a href="./HerpZerp.html">HerpZerp</a>
|
103
|
+
|
104
|
+
<li><a href="./HerpZerp/DerpGerp.html">HerpZerp::DerpGerp</a>
|
105
|
+
|
106
|
+
<li><a href="./HerpZerp/DerpGerp/FooBar.html">HerpZerp::DerpGerp::FooBar</a>
|
107
|
+
|
108
|
+
<li><a href="./BlockValidator.html">BlockValidator</a>
|
109
|
+
|
110
|
+
<li><a href="./ExistenceValidator.html">ExistenceValidator</a>
|
111
|
+
|
112
|
+
<li><a href="./FooBar.html">FooBar</a>
|
113
|
+
|
114
|
+
<li><a href="./Persister.html">Persister</a>
|
115
|
+
|
116
|
+
<li><a href="./Persisting.html">Persisting</a>
|
117
|
+
|
118
|
+
<li><a href="./PresenceValidator.html">PresenceValidator</a>
|
119
|
+
|
120
|
+
<li><a href="./Role.html">Role</a>
|
121
|
+
|
122
|
+
<li><a href="./Scheduler.html">Scheduler</a>
|
123
|
+
|
124
|
+
<li><a href="./SelfExistenceValidator.html">SelfExistenceValidator</a>
|
125
|
+
|
126
|
+
<li><a href="./TestPersister.html">TestPersister</a>
|
127
|
+
|
128
|
+
<li><a href="./Validating.html">Validating</a>
|
129
|
+
|
130
|
+
</ul>
|
131
|
+
</nav>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
</nav>
|
135
|
+
|
136
|
+
<div id="documentation">
|
137
|
+
<h1 class="class">class BlockValidator</h1>
|
138
|
+
|
139
|
+
<div id="description" class="description">
|
140
|
+
|
141
|
+
<p>Takes a block, and uses it to determine validity,</p>
|
142
|
+
|
143
|
+
</div><!-- description -->
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- Methods -->
|
158
|
+
|
159
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
160
|
+
<h3 class="section-header">Public Class Methods</h3>
|
161
|
+
|
162
|
+
|
163
|
+
<div id="method-c-new" class="method-detail ">
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<span class="method-name">new</span><span
|
167
|
+
class="method-args">(block, message_block)</span>
|
168
|
+
<span class="method-click-advice">click to toggle source</span>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<div class="method-source-code" id="new-source">
|
179
|
+
<pre><span class="ruby-comment"># File lib/roles/validation/block_validator.rb, line 3</span>
|
180
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">block</span>, <span class="ruby-identifier">message_block</span>)
|
181
|
+
<span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
|
182
|
+
<span class="ruby-ivar">@message_block</span> = <span class="ruby-identifier">message_block</span>
|
183
|
+
<span class="ruby-keyword">end</span></pre>
|
184
|
+
</div><!-- new-source -->
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</div><!-- new-method -->
|
192
|
+
|
193
|
+
|
194
|
+
</section><!-- public-class-method-details -->
|
195
|
+
|
196
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
197
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
198
|
+
|
199
|
+
|
200
|
+
<div id="method-i-error_message" class="method-detail ">
|
201
|
+
|
202
|
+
<div class="method-heading">
|
203
|
+
<span class="method-name">error_message</span><span
|
204
|
+
class="method-args">(validated)</span>
|
205
|
+
<span class="method-click-advice">click to toggle source</span>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
<div class="method-description">
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<div class="method-source-code" id="error_message-source">
|
216
|
+
<pre><span class="ruby-comment"># File lib/roles/validation/block_validator.rb, line 12</span>
|
217
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">error_message</span>(<span class="ruby-identifier">validated</span>)
|
218
|
+
<span class="ruby-ivar">@message_block</span>.<span class="ruby-identifier">call</span>
|
219
|
+
<span class="ruby-keyword">end</span></pre>
|
220
|
+
</div><!-- error_message-source -->
|
221
|
+
|
222
|
+
</div>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</div><!-- error_message-method -->
|
228
|
+
|
229
|
+
|
230
|
+
<div id="method-i-valid-3F" class="method-detail ">
|
231
|
+
|
232
|
+
<div class="method-heading">
|
233
|
+
<span class="method-name">valid?</span><span
|
234
|
+
class="method-args">(valdated)</span>
|
235
|
+
<span class="method-click-advice">click to toggle source</span>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
<div class="method-description">
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
<div class="method-source-code" id="valid-3F-source">
|
246
|
+
<pre><span class="ruby-comment"># File lib/roles/validation/block_validator.rb, line 8</span>
|
247
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valid?</span>(<span class="ruby-identifier">valdated</span>)
|
248
|
+
<span class="ruby-ivar">@block</span>.<span class="ruby-identifier">call</span>
|
249
|
+
<span class="ruby-keyword">end</span></pre>
|
250
|
+
</div><!-- valid-3F-source -->
|
251
|
+
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
</div><!-- valid-3F-method -->
|
258
|
+
|
259
|
+
|
260
|
+
</section><!-- public-instance-method-details -->
|
261
|
+
|
262
|
+
</section><!-- 5Buntitled-5D -->
|
263
|
+
|
264
|
+
</div><!-- documentation -->
|
265
|
+
|
266
|
+
|
267
|
+
<footer id="validator-badges">
|
268
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
269
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
|
270
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
271
|
+
</footer>
|
272
|
+
|
@@ -0,0 +1,276 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class ClosureValidator - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "./";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="./index.html">Home</a>
|
28
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/roles/validation/closure_validator.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-error_message">#error_message</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-valid-3F">#valid?</a>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
</nav>
|
81
|
+
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div id="project-metadata">
|
85
|
+
<nav id="fileindex-section" class="section project-section">
|
86
|
+
<h3 class="section-header">Pages</h3>
|
87
|
+
|
88
|
+
<ul>
|
89
|
+
|
90
|
+
<li class="file"><a href="./README.html">README</a>
|
91
|
+
|
92
|
+
</ul>
|
93
|
+
</nav>
|
94
|
+
|
95
|
+
<nav id="classindex-section" class="section project-section">
|
96
|
+
<h3 class="section-header">Class and Module Index</h3>
|
97
|
+
|
98
|
+
<ul class="link-list">
|
99
|
+
|
100
|
+
<li><a href="./Dirt.html">Dirt</a>
|
101
|
+
|
102
|
+
<li><a href="./Dirt/MemoryPersister.html">Dirt::MemoryPersister</a>
|
103
|
+
|
104
|
+
<li><a href="./Dirt/MemoryRecord.html">Dirt::MemoryRecord</a>
|
105
|
+
|
106
|
+
<li><a href="./Dirt/MissingRecordError.html">Dirt::MissingRecordError</a>
|
107
|
+
|
108
|
+
<li><a href="./Dirt/Model.html">Dirt::Model</a>
|
109
|
+
|
110
|
+
<li><a href="./Dirt/NoPersisterError.html">Dirt::NoPersisterError</a>
|
111
|
+
|
112
|
+
<li><a href="./Dirt/Relation.html">Dirt::Relation</a>
|
113
|
+
|
114
|
+
<li><a href="./Dirt/Role.html">Dirt::Role</a>
|
115
|
+
|
116
|
+
<li><a href="./Dirt/TooManyRecordsError.html">Dirt::TooManyRecordsError</a>
|
117
|
+
|
118
|
+
<li><a href="./Dirt/TransactionError.html">Dirt::TransactionError</a>
|
119
|
+
|
120
|
+
<li><a href="./ClosureValidator.html">ClosureValidator</a>
|
121
|
+
|
122
|
+
<li><a href="./ExistenceValidator.html">ExistenceValidator</a>
|
123
|
+
|
124
|
+
<li><a href="./Persister.html">Persister</a>
|
125
|
+
|
126
|
+
<li><a href="./Persisting.html">Persisting</a>
|
127
|
+
|
128
|
+
<li><a href="./PresenceValidator.html">PresenceValidator</a>
|
129
|
+
|
130
|
+
<li><a href="./SelfExistenceValidator.html">SelfExistenceValidator</a>
|
131
|
+
|
132
|
+
<li><a href="./Validating.html">Validating</a>
|
133
|
+
|
134
|
+
</ul>
|
135
|
+
</nav>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
</nav>
|
139
|
+
|
140
|
+
<div id="documentation">
|
141
|
+
<h1 class="class">class ClosureValidator</h1>
|
142
|
+
|
143
|
+
<div id="description" class="description">
|
144
|
+
|
145
|
+
<p>Takes a block, and uses it to determine validity,</p>
|
146
|
+
|
147
|
+
</div><!-- description -->
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<!-- Methods -->
|
162
|
+
|
163
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
164
|
+
<h3 class="section-header">Public Class Methods</h3>
|
165
|
+
|
166
|
+
|
167
|
+
<div id="method-c-new" class="method-detail ">
|
168
|
+
|
169
|
+
<div class="method-heading">
|
170
|
+
<span class="method-name">new</span><span
|
171
|
+
class="method-args">(block, message_block)</span>
|
172
|
+
<span class="method-click-advice">click to toggle source</span>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
|
176
|
+
<div class="method-description">
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<div class="method-source-code" id="new-source">
|
183
|
+
<pre><span class="ruby-comment"># File lib/roles/validation/closure_validator.rb, line 3</span>
|
184
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">block</span>, <span class="ruby-identifier">message_block</span>)
|
185
|
+
<span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
|
186
|
+
<span class="ruby-ivar">@message_block</span> = <span class="ruby-identifier">message_block</span>
|
187
|
+
<span class="ruby-keyword">end</span></pre>
|
188
|
+
</div><!-- new-source -->
|
189
|
+
|
190
|
+
</div>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
</div><!-- new-method -->
|
196
|
+
|
197
|
+
|
198
|
+
</section><!-- public-class-method-details -->
|
199
|
+
|
200
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
201
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
202
|
+
|
203
|
+
|
204
|
+
<div id="method-i-error_message" class="method-detail ">
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">error_message</span><span
|
208
|
+
class="method-args">(validated)</span>
|
209
|
+
<span class="method-click-advice">click to toggle source</span>
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<div class="method-source-code" id="error_message-source">
|
220
|
+
<pre><span class="ruby-comment"># File lib/roles/validation/closure_validator.rb, line 12</span>
|
221
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">error_message</span>(<span class="ruby-identifier">validated</span>)
|
222
|
+
<span class="ruby-ivar">@message_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">validated</span>)
|
223
|
+
<span class="ruby-keyword">end</span></pre>
|
224
|
+
</div><!-- error_message-source -->
|
225
|
+
|
226
|
+
</div>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</div><!-- error_message-method -->
|
232
|
+
|
233
|
+
|
234
|
+
<div id="method-i-valid-3F" class="method-detail ">
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<span class="method-name">valid?</span><span
|
238
|
+
class="method-args">(validated)</span>
|
239
|
+
<span class="method-click-advice">click to toggle source</span>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method-description">
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
<div class="method-source-code" id="valid-3F-source">
|
250
|
+
<pre><span class="ruby-comment"># File lib/roles/validation/closure_validator.rb, line 8</span>
|
251
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valid?</span>(<span class="ruby-identifier">validated</span>)
|
252
|
+
<span class="ruby-ivar">@block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">validated</span>)
|
253
|
+
<span class="ruby-keyword">end</span></pre>
|
254
|
+
</div><!-- valid-3F-source -->
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</div><!-- valid-3F-method -->
|
262
|
+
|
263
|
+
|
264
|
+
</section><!-- public-instance-method-details -->
|
265
|
+
|
266
|
+
</section><!-- 5Buntitled-5D -->
|
267
|
+
|
268
|
+
</div><!-- documentation -->
|
269
|
+
|
270
|
+
|
271
|
+
<footer id="validator-badges">
|
272
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
273
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
|
274
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
275
|
+
</footer>
|
276
|
+
|