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,278 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class SelfExistenceValidator - 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/self_existence_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 SelfExistenceValidator</h1>
142
+
143
+ <div id="description" class="description">
144
+
145
+ <p>Tests for the existence of the given id in the persister.</p>
146
+
147
+ <p>For more about validation, see <a href="Validating.html">Validating</a></p>
148
+
149
+ </div><!-- description -->
150
+
151
+
152
+
153
+
154
+ <section id="5Buntitled-5D" class="documentation-section">
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+ <!-- Methods -->
164
+
165
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
166
+ <h3 class="section-header">Public Class Methods</h3>
167
+
168
+
169
+ <div id="method-c-new" class="method-detail ">
170
+
171
+ <div class="method-heading">
172
+ <span class="method-name">new</span><span
173
+ class="method-args">(type, id)</span>
174
+ <span class="method-click-advice">click to toggle source</span>
175
+ </div>
176
+
177
+
178
+ <div class="method-description">
179
+
180
+
181
+
182
+
183
+
184
+ <div class="method-source-code" id="new-source">
185
+ <pre><span class="ruby-comment"># File lib/roles/validation/self_existence_validator.rb, line 5</span>
186
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">id</span>)
187
+ <span class="ruby-ivar">@type</span> = <span class="ruby-identifier">type</span>
188
+ <span class="ruby-ivar">@id</span> = <span class="ruby-identifier">id</span>
189
+ <span class="ruby-keyword">end</span></pre>
190
+ </div><!-- new-source -->
191
+
192
+ </div>
193
+
194
+
195
+
196
+
197
+ </div><!-- new-method -->
198
+
199
+
200
+ </section><!-- public-class-method-details -->
201
+
202
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
203
+ <h3 class="section-header">Public Instance Methods</h3>
204
+
205
+
206
+ <div id="method-i-error_message" class="method-detail ">
207
+
208
+ <div class="method-heading">
209
+ <span class="method-name">error_message</span><span
210
+ class="method-args">(validated)</span>
211
+ <span class="method-click-advice">click to toggle source</span>
212
+ </div>
213
+
214
+
215
+ <div class="method-description">
216
+
217
+
218
+
219
+
220
+
221
+ <div class="method-source-code" id="error_message-source">
222
+ <pre><span class="ruby-comment"># File lib/roles/validation/self_existence_validator.rb, line 15</span>
223
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">error_message</span>(<span class="ruby-identifier">validated</span>)
224
+ <span class="ruby-node">&quot;That #{@type.to_s.demodulize.downcase} (id: #{ @id || &quot;nil&quot; }) does not exist.&quot;</span>
225
+ <span class="ruby-keyword">end</span></pre>
226
+ </div><!-- error_message-source -->
227
+
228
+ </div>
229
+
230
+
231
+
232
+
233
+ </div><!-- error_message-method -->
234
+
235
+
236
+ <div id="method-i-valid-3F" class="method-detail ">
237
+
238
+ <div class="method-heading">
239
+ <span class="method-name">valid?</span><span
240
+ class="method-args">(validated)</span>
241
+ <span class="method-click-advice">click to toggle source</span>
242
+ </div>
243
+
244
+
245
+ <div class="method-description">
246
+
247
+ <p><code>true</code> if the validated object exists in the persister.</p>
248
+
249
+
250
+
251
+ <div class="method-source-code" id="valid-3F-source">
252
+ <pre><span class="ruby-comment"># File lib/roles/validation/self_existence_validator.rb, line 11</span>
253
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">valid?</span>(<span class="ruby-identifier">validated</span>)
254
+ <span class="ruby-constant">Persister</span>.<span class="ruby-identifier">for</span>(<span class="ruby-ivar">@type</span>).<span class="ruby-identifier">exists?</span>(<span class="ruby-ivar">@id</span>)
255
+ <span class="ruby-keyword">end</span></pre>
256
+ </div><!-- valid-3F-source -->
257
+
258
+ </div>
259
+
260
+
261
+
262
+
263
+ </div><!-- valid-3F-method -->
264
+
265
+
266
+ </section><!-- public-instance-method-details -->
267
+
268
+ </section><!-- 5Buntitled-5D -->
269
+
270
+ </div><!-- documentation -->
271
+
272
+
273
+ <footer id="validator-badges">
274
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
275
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
276
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
277
+ </footer>
278
+
@@ -0,0 +1,411 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class TestPersister - 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>spec/test_persister.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-all">#all</a>
76
+
77
+ <li><a href="#method-i-children_of">#children_of</a>
78
+
79
+ <li><a href="#method-i-delete">#delete</a>
80
+
81
+ <li><a href="#method-i-exists-3F">#exists?</a>
82
+
83
+ <li><a href="#method-i-load">#load</a>
84
+
85
+ <li><a href="#method-i-save">#save</a>
86
+
87
+ </ul>
88
+ </nav>
89
+
90
+ </div>
91
+
92
+ <div id="project-metadata">
93
+ <nav id="fileindex-section" class="section project-section">
94
+ <h3 class="section-header">Pages</h3>
95
+
96
+ <ul>
97
+
98
+ <li class="file"><a href="./Gemfile.html">Gemfile</a>
99
+
100
+ <li class="file"><a href="./README.html">README</a>
101
+
102
+ </ul>
103
+ </nav>
104
+
105
+ <nav id="classindex-section" class="section project-section">
106
+ <h3 class="section-header">Class and Module Index</h3>
107
+
108
+ <ul class="link-list">
109
+
110
+ <li><a href="./HerpZerp.html">HerpZerp</a>
111
+
112
+ <li><a href="./HerpZerp/DerpGerp.html">HerpZerp::DerpGerp</a>
113
+
114
+ <li><a href="./HerpZerp/DerpGerp/FooBar.html">HerpZerp::DerpGerp::FooBar</a>
115
+
116
+ <li><a href="./BlockValidator.html">BlockValidator</a>
117
+
118
+ <li><a href="./ExistenceValidator.html">ExistenceValidator</a>
119
+
120
+ <li><a href="./FooBar.html">FooBar</a>
121
+
122
+ <li><a href="./Persister.html">Persister</a>
123
+
124
+ <li><a href="./Persisting.html">Persisting</a>
125
+
126
+ <li><a href="./PresenceValidator.html">PresenceValidator</a>
127
+
128
+ <li><a href="./Role.html">Role</a>
129
+
130
+ <li><a href="./Scheduler.html">Scheduler</a>
131
+
132
+ <li><a href="./SelfExistenceValidator.html">SelfExistenceValidator</a>
133
+
134
+ <li><a href="./TestPersister.html">TestPersister</a>
135
+
136
+ <li><a href="./Validating.html">Validating</a>
137
+
138
+ </ul>
139
+ </nav>
140
+
141
+ </div>
142
+ </nav>
143
+
144
+ <div id="documentation">
145
+ <h1 class="class">class TestPersister</h1>
146
+
147
+ <div id="description" class="description">
148
+
149
+ <p>An in-memory implementation of persistence.</p>
150
+
151
+ </div><!-- description -->
152
+
153
+
154
+
155
+
156
+ <section id="5Buntitled-5D" class="documentation-section">
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <!-- Methods -->
166
+
167
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
168
+ <h3 class="section-header">Public Class Methods</h3>
169
+
170
+
171
+ <div id="method-c-new" class="method-detail ">
172
+
173
+ <div class="method-heading">
174
+ <span class="method-name">new</span><span
175
+ class="method-args">()</span>
176
+ <span class="method-click-advice">click to toggle source</span>
177
+ </div>
178
+
179
+
180
+ <div class="method-description">
181
+
182
+
183
+
184
+
185
+
186
+ <div class="method-source-code" id="new-source">
187
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 3</span>
188
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
189
+ <span class="ruby-ivar">@next_id</span> = <span class="ruby-value">0</span>
190
+ <span class="ruby-ivar">@records</span> = {}
191
+ <span class="ruby-keyword">end</span></pre>
192
+ </div><!-- new-source -->
193
+
194
+ </div>
195
+
196
+
197
+
198
+
199
+ </div><!-- new-method -->
200
+
201
+
202
+ </section><!-- public-class-method-details -->
203
+
204
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
205
+ <h3 class="section-header">Public Instance Methods</h3>
206
+
207
+
208
+ <div id="method-i-all" class="method-detail ">
209
+
210
+ <div class="method-heading">
211
+ <span class="method-name">all</span><span
212
+ class="method-args">()</span>
213
+ <span class="method-click-advice">click to toggle source</span>
214
+ </div>
215
+
216
+
217
+ <div class="method-description">
218
+
219
+ <p>Returns the list of all records.</p>
220
+
221
+
222
+
223
+ <div class="method-source-code" id="all-source">
224
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 31</span>
225
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">all</span>
226
+ <span class="ruby-ivar">@records</span>.<span class="ruby-identifier">values</span>
227
+ <span class="ruby-keyword">end</span></pre>
228
+ </div><!-- all-source -->
229
+
230
+ </div>
231
+
232
+
233
+
234
+
235
+ </div><!-- all-method -->
236
+
237
+
238
+ <div id="method-i-children_of" class="method-detail ">
239
+
240
+ <div class="method-heading">
241
+ <span class="method-name">children_of</span><span
242
+ class="method-args">(record)</span>
243
+ <span class="method-click-advice">click to toggle source</span>
244
+ </div>
245
+
246
+
247
+ <div class="method-description">
248
+
249
+
250
+
251
+
252
+
253
+ <div class="method-source-code" id="children_of-source">
254
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 21</span>
255
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">children_of</span>(<span class="ruby-identifier">record</span>)
256
+ <span class="ruby-ivar">@records</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">parent_id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">id</span> }
257
+ <span class="ruby-keyword">end</span></pre>
258
+ </div><!-- children_of-source -->
259
+
260
+ </div>
261
+
262
+
263
+
264
+
265
+ </div><!-- children_of-method -->
266
+
267
+
268
+ <div id="method-i-delete" class="method-detail ">
269
+
270
+ <div class="method-heading">
271
+ <span class="method-name">delete</span><span
272
+ class="method-args">(id)</span>
273
+ <span class="method-click-advice">click to toggle source</span>
274
+ </div>
275
+
276
+
277
+ <div class="method-description">
278
+
279
+ <p>Removes the record with the given id.</p>
280
+
281
+
282
+
283
+ <div class="method-source-code" id="delete-source">
284
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 36</span>
285
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">id</span>)
286
+ <span class="ruby-ivar">@records</span> <span class="ruby-operator">||=</span> []
287
+
288
+ <span class="ruby-ivar">@records</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">id</span>)
289
+ <span class="ruby-keyword">end</span></pre>
290
+ </div><!-- delete-source -->
291
+
292
+ </div>
293
+
294
+
295
+
296
+
297
+ </div><!-- delete-method -->
298
+
299
+
300
+ <div id="method-i-exists-3F" class="method-detail ">
301
+
302
+ <div class="method-heading">
303
+ <span class="method-name">exists?</span><span
304
+ class="method-args">(id)</span>
305
+ <span class="method-click-advice">click to toggle source</span>
306
+ </div>
307
+
308
+
309
+ <div class="method-description">
310
+
311
+ <p>determines whether a record exists with the given id</p>
312
+
313
+
314
+
315
+ <div class="method-source-code" id="exists-3F-source">
316
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 43</span>
317
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">id</span>)
318
+ <span class="ruby-ivar">@records</span>[<span class="ruby-identifier">id</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
319
+ <span class="ruby-keyword">end</span></pre>
320
+ </div><!-- exists-3F-source -->
321
+
322
+ </div>
323
+
324
+
325
+
326
+
327
+ </div><!-- exists-3F-method -->
328
+
329
+
330
+ <div id="method-i-load" class="method-detail ">
331
+
332
+ <div class="method-heading">
333
+ <span class="method-name">load</span><span
334
+ class="method-args">(id)</span>
335
+ <span class="method-click-advice">click to toggle source</span>
336
+ </div>
337
+
338
+
339
+ <div class="method-description">
340
+
341
+ <p>Returns the record with the given id.</p>
342
+
343
+
344
+
345
+ <div class="method-source-code" id="load-source">
346
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 26</span>
347
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">load</span>(<span class="ruby-identifier">id</span>)
348
+ <span class="ruby-ivar">@records</span>[<span class="ruby-identifier">id</span>]
349
+ <span class="ruby-keyword">end</span></pre>
350
+ </div><!-- load-source -->
351
+
352
+ </div>
353
+
354
+
355
+
356
+
357
+ </div><!-- load-method -->
358
+
359
+
360
+ <div id="method-i-save" class="method-detail ">
361
+
362
+ <div class="method-heading">
363
+ <span class="method-name">save</span><span
364
+ class="method-args">(data, id=nil)</span>
365
+ <span class="method-click-advice">click to toggle source</span>
366
+ </div>
367
+
368
+
369
+ <div class="method-description">
370
+
371
+ <p>Saves the record to the array either under the given id, or a new one if
372
+ none is provided,</p>
373
+
374
+
375
+
376
+ <div class="method-source-code" id="save-source">
377
+ <pre><span class="ruby-comment"># File spec/test_persister.rb, line 9</span>
378
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">id</span>=<span class="ruby-keyword">nil</span>)
379
+ <span class="ruby-identifier">p</span> = <span class="ruby-constant">Persisting</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">data</span>)
380
+
381
+ <span class="ruby-identifier">id</span> = <span class="ruby-identifier">id</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@next_id</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
382
+
383
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">id</span> = <span class="ruby-identifier">id</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">id</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@next_id</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
384
+
385
+ <span class="ruby-ivar">@records</span>[<span class="ruby-identifier">id</span>] = <span class="ruby-identifier">p</span>
386
+
387
+ <span class="ruby-identifier">p</span>
388
+ <span class="ruby-keyword">end</span></pre>
389
+ </div><!-- save-source -->
390
+
391
+ </div>
392
+
393
+
394
+
395
+
396
+ </div><!-- save-method -->
397
+
398
+
399
+ </section><!-- public-instance-method-details -->
400
+
401
+ </section><!-- 5Buntitled-5D -->
402
+
403
+ </div><!-- documentation -->
404
+
405
+
406
+ <footer id="validator-badges">
407
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
408
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
409
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
410
+ </footer>
411
+