dirt-core 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/Gemfile +8 -0
  2. data/Gemfile.lock +46 -0
  3. data/MIT-LICENSE +23 -0
  4. data/README +14 -0
  5. data/doc/BlockValidator.html +272 -0
  6. data/doc/ClosureValidator.html +276 -0
  7. data/doc/Dirt.html +158 -0
  8. data/doc/Dirt/FooBar.html +167 -0
  9. data/doc/Dirt/HerpZerp.html +161 -0
  10. data/doc/Dirt/HerpZerp/DerpGerp.html +161 -0
  11. data/doc/Dirt/HerpZerp/DerpGerp/FooBar.html +167 -0
  12. data/doc/Dirt/MemoryPersister.html +453 -0
  13. data/doc/Dirt/MemoryRecord.html +157 -0
  14. data/doc/Dirt/MissingRecordError.html +157 -0
  15. data/doc/Dirt/Model.html +320 -0
  16. data/doc/Dirt/NoPersisterError.html +157 -0
  17. data/doc/Dirt/Relation.html +338 -0
  18. data/doc/Dirt/Role.html +345 -0
  19. data/doc/Dirt/TooManyRecordsError.html +157 -0
  20. data/doc/Dirt/TransactionError.html +157 -0
  21. data/doc/ExistenceValidator.html +316 -0
  22. data/doc/FooBar.html +153 -0
  23. data/doc/Gemfile.html +131 -0
  24. data/doc/HerpZerp.html +147 -0
  25. data/doc/HerpZerp/DerpGerp.html +147 -0
  26. data/doc/HerpZerp/DerpGerp/FooBar.html +153 -0
  27. data/doc/Persister.html +311 -0
  28. data/doc/Persisting.html +413 -0
  29. data/doc/PresenceValidator.html +281 -0
  30. data/doc/README.html +132 -0
  31. data/doc/Role.html +309 -0
  32. data/doc/Scheduler.html +147 -0
  33. data/doc/SelfExistenceValidator.html +278 -0
  34. data/doc/TestPersister.html +411 -0
  35. data/doc/Validating.html +293 -0
  36. data/doc/created.rid +18 -0
  37. data/doc/images/add.png +0 -0
  38. data/doc/images/brick.png +0 -0
  39. data/doc/images/brick_link.png +0 -0
  40. data/doc/images/bug.png +0 -0
  41. data/doc/images/bullet_black.png +0 -0
  42. data/doc/images/bullet_toggle_minus.png +0 -0
  43. data/doc/images/bullet_toggle_plus.png +0 -0
  44. data/doc/images/date.png +0 -0
  45. data/doc/images/delete.png +0 -0
  46. data/doc/images/find.png +0 -0
  47. data/doc/images/loadingAnimation.gif +0 -0
  48. data/doc/images/macFFBgHack.png +0 -0
  49. data/doc/images/package.png +0 -0
  50. data/doc/images/page_green.png +0 -0
  51. data/doc/images/page_white_text.png +0 -0
  52. data/doc/images/page_white_width.png +0 -0
  53. data/doc/images/plugin.png +0 -0
  54. data/doc/images/ruby.png +0 -0
  55. data/doc/images/tag_blue.png +0 -0
  56. data/doc/images/tag_green.png +0 -0
  57. data/doc/images/transparent.png +0 -0
  58. data/doc/images/wrench.png +0 -0
  59. data/doc/images/wrench_orange.png +0 -0
  60. data/doc/images/zoom.png +0 -0
  61. data/doc/index.html +110 -0
  62. data/doc/js/darkfish.js +155 -0
  63. data/doc/js/jquery.js +18 -0
  64. data/doc/js/navigation.js +142 -0
  65. data/doc/js/search.js +94 -0
  66. data/doc/js/search_index.js +1 -0
  67. data/doc/js/searcher.js +228 -0
  68. data/doc/rdoc.css +543 -0
  69. data/doc/table_of_contents.html +203 -0
  70. data/lib/dirt/bdd/matchers.rb +10 -0
  71. data/lib/dirt/bdd/persister_spec_helper.rb +213 -0
  72. data/lib/dirt/bdd/shared_examples.rb +29 -0
  73. data/lib/dirt/contexts/context.rb +15 -0
  74. data/lib/dirt/core.rb +36 -0
  75. data/lib/dirt/errors/missing_record_error.rb +4 -0
  76. data/lib/dirt/errors/no_persister_error.rb +4 -0
  77. data/lib/dirt/errors/too_many_records_error.rb +4 -0
  78. data/lib/dirt/errors/transaction_error.rb +4 -0
  79. data/lib/dirt/models/model_behaviour.rb +47 -0
  80. data/lib/dirt/persisters/memory_persister.rb +86 -0
  81. data/lib/dirt/persisters/persister.rb +54 -0
  82. data/lib/dirt/persisters/relation.rb +38 -0
  83. data/lib/dirt/roles/persisting.rb +73 -0
  84. data/lib/dirt/roles/role.rb +32 -0
  85. data/lib/dirt/roles/validating.rb +27 -0
  86. data/lib/dirt/roles/validation/closure_validator.rb +15 -0
  87. data/lib/dirt/roles/validation/existence_validator.rb +53 -0
  88. data/lib/dirt/roles/validation/presence_validator.rb +21 -0
  89. data/lib/dirt/roles/validation/self_existence_validator.rb +18 -0
  90. data/spec/isolations/closure_validator_spec.rb +57 -0
  91. data/spec/isolations/context_spec.rb +54 -0
  92. data/spec/isolations/existence_validator_spec.rb +151 -0
  93. data/spec/isolations/memory_persister_spec.rb +175 -0
  94. data/spec/isolations/model_spec.rb +91 -0
  95. data/spec/isolations/persister_spec.rb +113 -0
  96. data/spec/isolations/persisting_spec.rb +266 -0
  97. data/spec/isolations/presence_validator_spec.rb +63 -0
  98. data/spec/isolations/role_spec.rb +116 -0
  99. data/spec/isolations/self_existence_validator_spec.rb +64 -0
  100. data/spec/isolations/spec_helper.rb +26 -0
  101. data/spec/isolations/validating_spec.rb +88 -0
  102. metadata +161 -0
@@ -0,0 +1,293 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Validating - 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/validating.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"><a href="Dirt/Role.html">Dirt::Role</a>
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-errors">#errors</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 Validating</h1>
142
+
143
+ <div id="description" class="description">
144
+
145
+ <p>A Role for testing whether the wrapped object is valid, using the list of
146
+ validators provided in the constructor,</p>
147
+
148
+ <h2 id="label-Validators">Validators</h2>
149
+
150
+ <p>Each validator must respond to</p>
151
+ <ul><li>
152
+ <p><code>valid?</code> to return whether that validator passes, and</p>
153
+ </li><li>
154
+ <p><code>error_message</code> to return any errors found when
155
+ <code>valid?</code> is <code>false</code>.</p>
156
+ </li></ul>
157
+
158
+ </div><!-- description -->
159
+
160
+
161
+
162
+
163
+ <section id="5Buntitled-5D" class="documentation-section">
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+ <!-- Methods -->
173
+
174
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
175
+ <h3 class="section-header">Public Class Methods</h3>
176
+
177
+
178
+ <div id="method-c-new" class="method-detail ">
179
+
180
+ <div class="method-heading">
181
+ <span class="method-name">new</span><span
182
+ class="method-args">(decorated, validators)</span>
183
+ <span class="method-click-advice">click to toggle source</span>
184
+ </div>
185
+
186
+
187
+ <div class="method-description">
188
+
189
+ <p>Takes the decorated object and then the list of validators. See Role for
190
+ more on decoration.</p>
191
+
192
+
193
+
194
+ <div class="method-source-code" id="new-source">
195
+ <pre><span class="ruby-comment"># File lib/roles/validating.rb, line 9</span>
196
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">decorated</span>, <span class="ruby-identifier">validators</span>)
197
+ <span class="ruby-keyword">super</span>(<span class="ruby-identifier">decorated</span>)
198
+ <span class="ruby-ivar">@validators</span> = <span class="ruby-identifier">validators</span>
199
+ <span class="ruby-keyword">end</span></pre>
200
+ </div><!-- new-source -->
201
+
202
+ </div>
203
+
204
+
205
+
206
+
207
+ </div><!-- new-method -->
208
+
209
+
210
+ </section><!-- public-class-method-details -->
211
+
212
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
213
+ <h3 class="section-header">Public Instance Methods</h3>
214
+
215
+
216
+ <div id="method-i-errors" class="method-detail ">
217
+
218
+ <div class="method-heading">
219
+ <span class="method-name">errors</span><span
220
+ class="method-args">()</span>
221
+ <span class="method-click-advice">click to toggle source</span>
222
+ </div>
223
+
224
+
225
+ <div class="method-description">
226
+
227
+ <p>Returns a list of the string messages returned from the validators that
228
+ have failed.</p>
229
+
230
+
231
+
232
+ <div class="method-source-code" id="errors-source">
233
+ <pre><span class="ruby-comment"># File lib/roles/validating.rb, line 22</span>
234
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">errors</span>
235
+ <span class="ruby-ivar">@validators</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
236
+ <span class="ruby-identifier">v</span>.<span class="ruby-identifier">error_message</span>(<span class="ruby-ivar">@decorated</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">valid?</span>(<span class="ruby-ivar">@decorated</span>)
237
+ <span class="ruby-keyword">end</span>.<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">nil?</span> }
238
+ <span class="ruby-keyword">end</span></pre>
239
+ </div><!-- errors-source -->
240
+
241
+ </div>
242
+
243
+
244
+
245
+
246
+ </div><!-- errors-method -->
247
+
248
+
249
+ <div id="method-i-valid-3F" class="method-detail ">
250
+
251
+ <div class="method-heading">
252
+ <span class="method-name">valid?</span><span
253
+ class="method-args">()</span>
254
+ <span class="method-click-advice">click to toggle source</span>
255
+ </div>
256
+
257
+
258
+ <div class="method-description">
259
+
260
+ <p>Returns <code>true</code> <em>iff</em> every validator passes.</p>
261
+
262
+
263
+
264
+ <div class="method-source-code" id="valid-3F-source">
265
+ <pre><span class="ruby-comment"># File lib/roles/validating.rb, line 15</span>
266
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">valid?</span>
267
+ <span class="ruby-ivar">@validators</span>.<span class="ruby-identifier">all?</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
268
+ <span class="ruby-identifier">v</span>.<span class="ruby-identifier">valid?</span>(<span class="ruby-ivar">@decorated</span>)
269
+ <span class="ruby-keyword">end</span>
270
+ <span class="ruby-keyword">end</span></pre>
271
+ </div><!-- valid-3F-source -->
272
+
273
+ </div>
274
+
275
+
276
+
277
+
278
+ </div><!-- valid-3F-method -->
279
+
280
+
281
+ </section><!-- public-instance-method-details -->
282
+
283
+ </section><!-- 5Buntitled-5D -->
284
+
285
+ </div><!-- documentation -->
286
+
287
+
288
+ <footer id="validator-badges">
289
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
290
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
291
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
292
+ </footer>
293
+
@@ -0,0 +1,18 @@
1
+ Wed, 05 Mar 2014 13:03:45 -0700
2
+ README Wed, 19 Feb 2014 12:03:42 -0700
3
+ lib/dirt.rb Thu, 27 Feb 2014 14:26:13 -0700
4
+ lib/errors/too_many_records_error.rb Wed, 05 Mar 2014 12:58:31 -0700
5
+ lib/errors/transaction_error.rb Wed, 05 Mar 2014 12:58:39 -0700
6
+ lib/errors/no_persister_error.rb Wed, 05 Mar 2014 12:58:25 -0700
7
+ lib/errors/missing_record_error.rb Wed, 05 Mar 2014 12:42:38 -0700
8
+ lib/roles/persisting.rb Wed, 05 Mar 2014 13:01:28 -0700
9
+ lib/roles/validating.rb Wed, 05 Mar 2014 13:01:14 -0700
10
+ lib/roles/validation/closure_validator.rb Thu, 27 Feb 2014 14:26:13 -0700
11
+ lib/roles/validation/self_existence_validator.rb Wed, 19 Feb 2014 15:07:41 -0700
12
+ lib/roles/validation/existence_validator.rb Thu, 20 Feb 2014 14:03:16 -0700
13
+ lib/roles/validation/presence_validator.rb Wed, 19 Feb 2014 14:30:48 -0700
14
+ lib/roles/role.rb Wed, 05 Mar 2014 13:00:47 -0700
15
+ lib/models/model.rb Wed, 05 Mar 2014 12:58:55 -0700
16
+ lib/persisters/memory_persister.rb Wed, 05 Mar 2014 12:40:49 -0700
17
+ lib/persisters/relation.rb Wed, 05 Mar 2014 12:40:33 -0700
18
+ lib/persisters/persister.rb Wed, 05 Mar 2014 12:59:50 -0700
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>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>
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="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./README.html">README</a>
53
+
54
+ </ul>
55
+ </nav>
56
+
57
+ <nav id="classindex-section" class="section project-section">
58
+ <h3 class="section-header">Class and Module Index</h3>
59
+
60
+ <ul class="link-list">
61
+
62
+ <li><a href="./Dirt.html">Dirt</a>
63
+
64
+ <li><a href="./Dirt/MemoryPersister.html">Dirt::MemoryPersister</a>
65
+
66
+ <li><a href="./Dirt/MemoryRecord.html">Dirt::MemoryRecord</a>
67
+
68
+ <li><a href="./Dirt/MissingRecordError.html">Dirt::MissingRecordError</a>
69
+
70
+ <li><a href="./Dirt/Model.html">Dirt::Model</a>
71
+
72
+ <li><a href="./Dirt/NoPersisterError.html">Dirt::NoPersisterError</a>
73
+
74
+ <li><a href="./Dirt/Relation.html">Dirt::Relation</a>
75
+
76
+ <li><a href="./Dirt/Role.html">Dirt::Role</a>
77
+
78
+ <li><a href="./Dirt/TooManyRecordsError.html">Dirt::TooManyRecordsError</a>
79
+
80
+ <li><a href="./Dirt/TransactionError.html">Dirt::TransactionError</a>
81
+
82
+ <li><a href="./ClosureValidator.html">ClosureValidator</a>
83
+
84
+ <li><a href="./ExistenceValidator.html">ExistenceValidator</a>
85
+
86
+ <li><a href="./Persister.html">Persister</a>
87
+
88
+ <li><a href="./Persisting.html">Persisting</a>
89
+
90
+ <li><a href="./PresenceValidator.html">PresenceValidator</a>
91
+
92
+ <li><a href="./SelfExistenceValidator.html">SelfExistenceValidator</a>
93
+
94
+ <li><a href="./Validating.html">Validating</a>
95
+
96
+ </ul>
97
+ </nav>
98
+
99
+ </div>
100
+ </nav>
101
+
102
+ <p>This is the API documentation for RDoc Documentation.
103
+
104
+
105
+ <footer id="validator-badges">
106
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
107
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
108
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
109
+ </footer>
110
+