dirt-core 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,153 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class HerpZerp::DerpGerp::FooBar - 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/isolations/persister_spec.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
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div id="project-metadata">
|
71
|
+
<nav id="fileindex-section" class="section project-section">
|
72
|
+
<h3 class="section-header">Pages</h3>
|
73
|
+
|
74
|
+
<ul>
|
75
|
+
|
76
|
+
<li class="file"><a href="../../Gemfile.html">Gemfile</a>
|
77
|
+
|
78
|
+
<li class="file"><a href="../../README.html">README</a>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<nav id="classindex-section" class="section project-section">
|
84
|
+
<h3 class="section-header">Class and Module Index</h3>
|
85
|
+
|
86
|
+
<ul class="link-list">
|
87
|
+
|
88
|
+
<li><a href="../../HerpZerp.html">HerpZerp</a>
|
89
|
+
|
90
|
+
<li><a href="../../HerpZerp/DerpGerp.html">HerpZerp::DerpGerp</a>
|
91
|
+
|
92
|
+
<li><a href="../../HerpZerp/DerpGerp/FooBar.html">HerpZerp::DerpGerp::FooBar</a>
|
93
|
+
|
94
|
+
<li><a href="../../BlockValidator.html">BlockValidator</a>
|
95
|
+
|
96
|
+
<li><a href="../../ExistenceValidator.html">ExistenceValidator</a>
|
97
|
+
|
98
|
+
<li><a href="../../FooBar.html">FooBar</a>
|
99
|
+
|
100
|
+
<li><a href="../../Persister.html">Persister</a>
|
101
|
+
|
102
|
+
<li><a href="../../Persisting.html">Persisting</a>
|
103
|
+
|
104
|
+
<li><a href="../../PresenceValidator.html">PresenceValidator</a>
|
105
|
+
|
106
|
+
<li><a href="../../Role.html">Role</a>
|
107
|
+
|
108
|
+
<li><a href="../../Scheduler.html">Scheduler</a>
|
109
|
+
|
110
|
+
<li><a href="../../SelfExistenceValidator.html">SelfExistenceValidator</a>
|
111
|
+
|
112
|
+
<li><a href="../../TestPersister.html">TestPersister</a>
|
113
|
+
|
114
|
+
<li><a href="../../Validating.html">Validating</a>
|
115
|
+
|
116
|
+
</ul>
|
117
|
+
</nav>
|
118
|
+
|
119
|
+
</div>
|
120
|
+
</nav>
|
121
|
+
|
122
|
+
<div id="documentation">
|
123
|
+
<h1 class="class">class HerpZerp::DerpGerp::FooBar</h1>
|
124
|
+
|
125
|
+
<div id="description" class="description">
|
126
|
+
|
127
|
+
</div><!-- description -->
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
<!-- Methods -->
|
142
|
+
|
143
|
+
</section><!-- 5Buntitled-5D -->
|
144
|
+
|
145
|
+
</div><!-- documentation -->
|
146
|
+
|
147
|
+
|
148
|
+
<footer id="validator-badges">
|
149
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
150
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
|
151
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
152
|
+
</footer>
|
153
|
+
|
data/doc/Persister.html
ADDED
@@ -0,0 +1,311 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class Persister - 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/persisters/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-clear">::clear</a>
|
74
|
+
|
75
|
+
<li><a href="#method-c-for">::for</a>
|
76
|
+
|
77
|
+
<li><a href="#method-c-transaction">::transaction</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 Persister</h1>
|
142
|
+
|
143
|
+
<div id="description" class="description">
|
144
|
+
|
145
|
+
<p>This <a href="Persister.html">Persister</a> registry is the source for all
|
146
|
+
persisters in the system. Register persisters here with for.</p>
|
147
|
+
|
148
|
+
<h2 id="label-Persisters">Persisters</h2>
|
149
|
+
|
150
|
+
<p>All persisters must respond to the following:</p>
|
151
|
+
<ul><li>
|
152
|
+
<p><code>all</code> Returns all records.</p>
|
153
|
+
</li><li>
|
154
|
+
<p>+find(id)+ Returns the record with the given id.</p>
|
155
|
+
</li><li>
|
156
|
+
<p>+exists?(id)+ Determines whether a record exists with the given id</p>
|
157
|
+
</li><li>
|
158
|
+
<p>+save(data)+ Saves a new record.</p>
|
159
|
+
</li><li>
|
160
|
+
<p>+save(data, id)+ Saves a record at the given id.</p>
|
161
|
+
</li><li>
|
162
|
+
<p>+transaction(&block)+ Rolls back changes brought about during :yeild,
|
163
|
+
and re-raises a TransactionError iff that error is raised in the yeild.</p>
|
164
|
+
</li><li>
|
165
|
+
<p>delete(id) Deletes the record with the given id.</p>
|
166
|
+
</li></ul>
|
167
|
+
|
168
|
+
</div><!-- description -->
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
<!-- Methods -->
|
183
|
+
|
184
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
185
|
+
<h3 class="section-header">Public Class Methods</h3>
|
186
|
+
|
187
|
+
|
188
|
+
<div id="method-c-clear" class="method-detail ">
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<span class="method-name">clear</span><span
|
192
|
+
class="method-args">()</span>
|
193
|
+
<span class="method-click-advice">click to toggle source</span>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
|
199
|
+
<p>Forgets about all previously saved persisters.</p>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<div class="method-source-code" id="clear-source">
|
204
|
+
<pre><span class="ruby-comment"># File lib/persisters/persister.rb, line 34</span>
|
205
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">clear</span>
|
206
|
+
<span class="ruby-identifier">@@persisters</span> = <span class="ruby-keyword">nil</span>
|
207
|
+
<span class="ruby-keyword">end</span></pre>
|
208
|
+
</div><!-- clear-source -->
|
209
|
+
|
210
|
+
</div>
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</div><!-- clear-method -->
|
216
|
+
|
217
|
+
|
218
|
+
<div id="method-c-for" class="method-detail ">
|
219
|
+
|
220
|
+
<div class="method-heading">
|
221
|
+
<span class="method-name">for</span><span
|
222
|
+
class="method-args">(klass, persister=nil)</span>
|
223
|
+
<span class="method-click-advice">click to toggle source</span>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
|
227
|
+
<div class="method-description">
|
228
|
+
|
229
|
+
<p>If persister is supplied, then this sets the persister for the given class,
|
230
|
+
otherwise it returns the previously set persister for that class. If the
|
231
|
+
first argument is a class, it is converted to a symbol.</p>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<div class="method-source-code" id="for-source">
|
236
|
+
<pre><span class="ruby-comment"># File lib/persisters/persister.rb, line 22</span>
|
237
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-keyword">for</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">persister</span>=<span class="ruby-keyword">nil</span>)
|
238
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Class</span>
|
239
|
+
<span class="ruby-identifier">klass</span> = <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">demodulize</span>.<span class="ruby-identifier">underscore</span>.<span class="ruby-identifier">to_sym</span>
|
240
|
+
<span class="ruby-keyword">end</span>
|
241
|
+
|
242
|
+
<span class="ruby-identifier">@@persisters</span> <span class="ruby-operator">||=</span> {}
|
243
|
+
<span class="ruby-identifier">@@persisters</span>[<span class="ruby-identifier">klass</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">persister</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">persister</span>
|
244
|
+
|
245
|
+
<span class="ruby-identifier">@@persisters</span>[<span class="ruby-identifier">klass</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">Dirt</span><span class="ruby-operator">::</span><span class="ruby-constant">NoPersisterError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"There is no persister for \"#{klass.to_s.pluralize}\"."</span>))
|
246
|
+
<span class="ruby-keyword">end</span></pre>
|
247
|
+
</div><!-- for-source -->
|
248
|
+
|
249
|
+
</div>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
</div><!-- for-method -->
|
255
|
+
|
256
|
+
|
257
|
+
<div id="method-c-transaction" class="method-detail ">
|
258
|
+
|
259
|
+
<div class="method-heading">
|
260
|
+
<span class="method-name">transaction</span><span
|
261
|
+
class="method-args">(persister_list=[], &block)</span>
|
262
|
+
<span class="method-click-advice">click to toggle source</span>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
<div class="method-description">
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
<div class="method-source-code" id="transaction-source">
|
273
|
+
<pre><span class="ruby-comment"># File lib/persisters/persister.rb, line 39</span>
|
274
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">transaction</span>(<span class="ruby-identifier">persister_list</span>=[], &<span class="ruby-identifier">block</span>)
|
275
|
+
<span class="ruby-keyword">begin</span>
|
276
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">persister_list</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span>
|
277
|
+
<span class="ruby-identifier">yeild</span>
|
278
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">persister_list</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
279
|
+
<span class="ruby-identifier">persister_list</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">transaction</span> &<span class="ruby-identifier">block</span>
|
280
|
+
<span class="ruby-keyword">else</span>
|
281
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">transaction</span>(<span class="ruby-identifier">persister_list</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">persister_list</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)]) <span class="ruby-keyword">do</span>
|
282
|
+
<span class="ruby-identifier">persister_list</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">transaction</span> &<span class="ruby-identifier">block</span>
|
283
|
+
<span class="ruby-keyword">end</span>
|
284
|
+
<span class="ruby-keyword">end</span>
|
285
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Dirt</span><span class="ruby-operator">::</span><span class="ruby-constant">TransactionError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
286
|
+
{<span class="ruby-identifier">errors</span><span class="ruby-operator">:</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">"\n"</span>)}
|
287
|
+
<span class="ruby-keyword">end</span>
|
288
|
+
<span class="ruby-keyword">end</span></pre>
|
289
|
+
</div><!-- transaction-source -->
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
</div><!-- transaction-method -->
|
297
|
+
|
298
|
+
|
299
|
+
</section><!-- public-class-method-details -->
|
300
|
+
|
301
|
+
</section><!-- 5Buntitled-5D -->
|
302
|
+
|
303
|
+
</div><!-- documentation -->
|
304
|
+
|
305
|
+
|
306
|
+
<footer id="validator-badges">
|
307
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
308
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.2.
|
309
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
310
|
+
</footer>
|
311
|
+
|