dynamoid 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Dynamoid.gemspec +65 -3
- data/Gemfile +3 -0
- data/Gemfile.lock +6 -0
- data/README.markdown +117 -22
- data/Rakefile +22 -9
- data/VERSION +1 -1
- data/doc/.nojekyll +0 -0
- data/doc/Dynamoid.html +300 -0
- data/doc/Dynamoid/Adapter.html +1387 -0
- data/doc/Dynamoid/Adapter/AwsSdk.html +1561 -0
- data/doc/Dynamoid/Adapter/Local.html +1487 -0
- data/doc/Dynamoid/Associations.html +131 -0
- data/doc/Dynamoid/Associations/Association.html +1706 -0
- data/doc/Dynamoid/Associations/BelongsTo.html +339 -0
- data/doc/Dynamoid/Associations/ClassMethods.html +723 -0
- data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +339 -0
- data/doc/Dynamoid/Associations/HasMany.html +339 -0
- data/doc/Dynamoid/Associations/HasOne.html +339 -0
- data/doc/Dynamoid/Components.html +202 -0
- data/doc/Dynamoid/Config.html +395 -0
- data/doc/Dynamoid/Config/Options.html +609 -0
- data/doc/Dynamoid/Criteria.html +131 -0
- data/doc/Dynamoid/Criteria/Chain.html +759 -0
- data/doc/Dynamoid/Criteria/ClassMethods.html +98 -0
- data/doc/Dynamoid/Document.html +512 -0
- data/doc/Dynamoid/Document/ClassMethods.html +581 -0
- data/doc/Dynamoid/Errors.html +118 -0
- data/doc/Dynamoid/Errors/DocumentNotValid.html +210 -0
- data/doc/Dynamoid/Errors/Error.html +130 -0
- data/doc/Dynamoid/Errors/InvalidField.html +133 -0
- data/doc/Dynamoid/Errors/MissingRangeKey.html +133 -0
- data/doc/Dynamoid/Fields.html +649 -0
- data/doc/Dynamoid/Fields/ClassMethods.html +264 -0
- data/doc/Dynamoid/Finders.html +128 -0
- data/doc/Dynamoid/Finders/ClassMethods.html +502 -0
- data/doc/Dynamoid/Indexes.html +308 -0
- data/doc/Dynamoid/Indexes/ClassMethods.html +351 -0
- data/doc/Dynamoid/Indexes/Index.html +1089 -0
- data/doc/Dynamoid/Persistence.html +653 -0
- data/doc/Dynamoid/Persistence/ClassMethods.html +568 -0
- data/doc/Dynamoid/Validations.html +399 -0
- data/doc/_index.html +439 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.LICENSE.html +66 -0
- data/doc/file.README.html +279 -0
- data/doc/file_list.html +52 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +279 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +1054 -0
- data/doc/top-level-namespace.html +105 -0
- data/lib/dynamoid.rb +2 -1
- data/lib/dynamoid/adapter.rb +77 -6
- data/lib/dynamoid/adapter/aws_sdk.rb +96 -16
- data/lib/dynamoid/adapter/local.rb +84 -15
- data/lib/dynamoid/associations.rb +53 -4
- data/lib/dynamoid/associations/association.rb +154 -26
- data/lib/dynamoid/associations/belongs_to.rb +32 -6
- data/lib/dynamoid/associations/has_and_belongs_to_many.rb +29 -3
- data/lib/dynamoid/associations/has_many.rb +30 -4
- data/lib/dynamoid/associations/has_one.rb +26 -3
- data/lib/dynamoid/components.rb +7 -5
- data/lib/dynamoid/config.rb +15 -2
- data/lib/dynamoid/config/options.rb +8 -0
- data/lib/dynamoid/criteria.rb +7 -2
- data/lib/dynamoid/criteria/chain.rb +55 -8
- data/lib/dynamoid/document.rb +68 -7
- data/lib/dynamoid/errors.rb +17 -2
- data/lib/dynamoid/fields.rb +44 -1
- data/lib/dynamoid/finders.rb +32 -6
- data/lib/dynamoid/indexes.rb +22 -2
- data/lib/dynamoid/indexes/index.rb +48 -7
- data/lib/dynamoid/persistence.rb +111 -51
- data/lib/dynamoid/validations.rb +36 -0
- data/spec/app/models/address.rb +2 -1
- data/spec/app/models/camel_case.rb +11 -0
- data/spec/app/models/magazine.rb +4 -1
- data/spec/app/models/sponsor.rb +3 -1
- data/spec/app/models/subscription.rb +5 -1
- data/spec/app/models/user.rb +10 -1
- data/spec/dynamoid/associations/association_spec.rb +67 -1
- data/spec/dynamoid/associations/belongs_to_spec.rb +16 -1
- data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +7 -0
- data/spec/dynamoid/associations/has_many_spec.rb +14 -0
- data/spec/dynamoid/associations/has_one_spec.rb +10 -1
- data/spec/dynamoid/criteria_spec.rb +5 -1
- data/spec/dynamoid/document_spec.rb +23 -3
- data/spec/dynamoid/fields_spec.rb +10 -1
- data/spec/dynamoid/indexes/index_spec.rb +19 -0
- data/spec/dynamoid/persistence_spec.rb +24 -0
- data/spec/dynamoid/validations_spec.rb +36 -0
- metadata +105 -4
@@ -0,0 +1,131 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Dynamoid::Criteria
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../_index.html">Index (C)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Criteria</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: Dynamoid::Criteria
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<dt class="r1">Extended by:</dt>
|
70
|
+
<dd class="r1">ActiveSupport::Concern</dd>
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<dt class="r2">Included in:</dt>
|
78
|
+
<dd class="r2"><span class='object_link'><a href="Components.html" title="Dynamoid::Components (module)">Components</a></span></dd>
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
<dt class="r1 last">Defined in:</dt>
|
83
|
+
<dd class="r1 last">lib/dynamoid/criteria.rb<span class="defines">,<br />
|
84
|
+
lib/dynamoid/criteria/chain.rb</span>
|
85
|
+
</dd>
|
86
|
+
|
87
|
+
</dl>
|
88
|
+
<div class="clear"></div>
|
89
|
+
|
90
|
+
<h2>Overview</h2><div class="docstring">
|
91
|
+
<div class="discussion">
|
92
|
+
<p>Allows classes to be queried by where, all, first, and each and return criteria chains.</p>
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
<div class="tags">
|
98
|
+
|
99
|
+
|
100
|
+
</div><h2>Defined Under Namespace</h2>
|
101
|
+
<p class="children">
|
102
|
+
|
103
|
+
|
104
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Criteria/ClassMethods.html" title="Dynamoid::Criteria::ClassMethods (module)">ClassMethods</a></span>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Criteria/Chain.html" title="Dynamoid::Criteria::Chain (class)">Chain</a></span>
|
109
|
+
|
110
|
+
|
111
|
+
</p>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="footer">
|
125
|
+
Generated on Tue Mar 27 17:53:06 2012 by
|
126
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
127
|
+
0.7.5 (ruby-1.9.3).
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</body>
|
131
|
+
</html>
|
@@ -0,0 +1,759 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Dynamoid::Criteria::Chain
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '../..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../../_index.html">Index (C)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> » <span class='title'><span class='object_link'><a href="../Criteria.html" title="Dynamoid::Criteria (module)">Criteria</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Chain</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: Dynamoid::Criteria::Chain
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Object</span>
|
70
|
+
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
73
|
+
|
74
|
+
<li class="next">Dynamoid::Criteria::Chain</li>
|
75
|
+
|
76
|
+
</ul>
|
77
|
+
<a href="#" class="inheritanceTree">show all</a>
|
78
|
+
|
79
|
+
</dd>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<dt class="r2">Includes:</dt>
|
87
|
+
<dd class="r2">Enumerable</dd>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r1 last">Defined in:</dt>
|
94
|
+
<dd class="r1 last">lib/dynamoid/criteria/chain.rb</dd>
|
95
|
+
|
96
|
+
</dl>
|
97
|
+
<div class="clear"></div>
|
98
|
+
|
99
|
+
<h2>Overview</h2><div class="docstring">
|
100
|
+
<div class="discussion">
|
101
|
+
<p>The criteria chain is equivalent to an ActiveRecord relation (and realistically I should change the name from
|
102
|
+
chain to relation). It is a chainable object that builds up a query and eventually executes it either on an index
|
103
|
+
or by a full table scan.</p>
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
<div class="tags">
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
116
|
+
<ul class="summary">
|
117
|
+
|
118
|
+
<li class="public ">
|
119
|
+
<span class="summary_signature">
|
120
|
+
|
121
|
+
<a href="#query-instance_method" title="#query (instance method)">- (Object) <strong>query</strong> </a>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
</span>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute query.</p>
|
138
|
+
</div></span>
|
139
|
+
|
140
|
+
</li>
|
141
|
+
|
142
|
+
|
143
|
+
<li class="public ">
|
144
|
+
<span class="summary_signature">
|
145
|
+
|
146
|
+
<a href="#source-instance_method" title="#source (instance method)">- (Object) <strong>source</strong> </a>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
</span>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute source.</p>
|
163
|
+
</div></span>
|
164
|
+
|
165
|
+
</li>
|
166
|
+
|
167
|
+
|
168
|
+
<li class="public ">
|
169
|
+
<span class="summary_signature">
|
170
|
+
|
171
|
+
<a href="#values-instance_method" title="#values (instance method)">- (Object) <strong>values</strong> </a>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
</span>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute values.</p>
|
188
|
+
</div></span>
|
189
|
+
|
190
|
+
</li>
|
191
|
+
|
192
|
+
|
193
|
+
</ul>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<h2>
|
200
|
+
Instance Method Summary
|
201
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
202
|
+
</h2>
|
203
|
+
|
204
|
+
<ul class="summary">
|
205
|
+
|
206
|
+
<li class="public ">
|
207
|
+
<span class="summary_signature">
|
208
|
+
|
209
|
+
<a href="#all-instance_method" title="#all (instance method)">- (Object) <strong>all</strong> </a>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
</span>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<span class="summary_desc"><div class='inline'><p>Returns all the records matching the criteria.</p>
|
223
|
+
</div></span>
|
224
|
+
|
225
|
+
</li>
|
226
|
+
|
227
|
+
|
228
|
+
<li class="public ">
|
229
|
+
<span class="summary_signature">
|
230
|
+
|
231
|
+
<a href="#each-instance_method" title="#each (instance method)">- (Object) <strong>each</strong>(&block) </a>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
</span>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
<span class="summary_desc"><div class='inline'><p>Allows you to use the results of a search as an enumerable over the results found.</p>
|
245
|
+
</div></span>
|
246
|
+
|
247
|
+
</li>
|
248
|
+
|
249
|
+
|
250
|
+
<li class="public ">
|
251
|
+
<span class="summary_signature">
|
252
|
+
|
253
|
+
<a href="#first-instance_method" title="#first (instance method)">- (Object) <strong>first</strong> </a>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
</span>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'><p>Returns the first record matching the criteria.</p>
|
267
|
+
</div></span>
|
268
|
+
|
269
|
+
</li>
|
270
|
+
|
271
|
+
|
272
|
+
<li class="public ">
|
273
|
+
<span class="summary_signature">
|
274
|
+
|
275
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Chain) <strong>initialize</strong>(source) </a>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
</span>
|
280
|
+
|
281
|
+
<span class="note title constructor">constructor</span>
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
<span class="summary_desc"><div class='inline'><p>Create a new criteria chain.</p>
|
291
|
+
</div></span>
|
292
|
+
|
293
|
+
</li>
|
294
|
+
|
295
|
+
|
296
|
+
<li class="public ">
|
297
|
+
<span class="summary_signature">
|
298
|
+
|
299
|
+
<a href="#where-instance_method" title="#where (instance method)">- (Object) <strong>where</strong>(args) </a>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</span>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<span class="summary_desc"><div class='inline'><p>The workhorse method of the criteria chain.</p>
|
313
|
+
</div></span>
|
314
|
+
|
315
|
+
</li>
|
316
|
+
|
317
|
+
|
318
|
+
</ul>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<div id="constructor_details" class="method_details_list">
|
323
|
+
<h2>Constructor Details</h2>
|
324
|
+
|
325
|
+
<div class="method_details first">
|
326
|
+
<p class="signature first" id="initialize-instance_method">
|
327
|
+
|
328
|
+
- (<tt><span class='object_link'><a href="" title="Dynamoid::Criteria::Chain (class)">Chain</a></span></tt>) <strong>initialize</strong>(source)
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
</p><div class="docstring">
|
333
|
+
<div class="discussion">
|
334
|
+
<p>Create a new criteria chain.</p>
|
335
|
+
|
336
|
+
|
337
|
+
</div>
|
338
|
+
</div>
|
339
|
+
<div class="tags">
|
340
|
+
<h3>Parameters:</h3>
|
341
|
+
<ul class="param">
|
342
|
+
|
343
|
+
<li>
|
344
|
+
|
345
|
+
<span class='name'>source</span>
|
346
|
+
|
347
|
+
|
348
|
+
<span class='type'>(<tt>Class</tt>)</span>
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
—
|
353
|
+
<div class='inline'><p>the class upon which the ultimate query will be performed.</p>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
</li>
|
357
|
+
|
358
|
+
</ul>
|
359
|
+
|
360
|
+
|
361
|
+
</div><table class="source_code">
|
362
|
+
<tr>
|
363
|
+
<td>
|
364
|
+
<pre class="lines">
|
365
|
+
|
366
|
+
|
367
|
+
15
|
368
|
+
16
|
369
|
+
17
|
370
|
+
18</pre>
|
371
|
+
</td>
|
372
|
+
<td>
|
373
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 15</span>
|
374
|
+
|
375
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='rparen'>)</span>
|
376
|
+
<span class='ivar'>@query</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
377
|
+
<span class='ivar'>@source</span> <span class='op'>=</span> <span class='id identifier rubyid_source'>source</span>
|
378
|
+
<span class='kw'>end</span></pre>
|
379
|
+
</td>
|
380
|
+
</tr>
|
381
|
+
</table>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
<div id="instance_attr_details" class="attr_details">
|
387
|
+
<h2>Instance Attribute Details</h2>
|
388
|
+
|
389
|
+
|
390
|
+
<span id="query=-instance_method"></span>
|
391
|
+
<span id="query-instance_method"></span>
|
392
|
+
<div class="method_details first">
|
393
|
+
<p class="signature first" id="query-instance_method">
|
394
|
+
|
395
|
+
- (<tt>Object</tt>) <strong>query</strong>
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
</p><div class="docstring">
|
400
|
+
<div class="discussion">
|
401
|
+
<p>Returns the value of attribute query</p>
|
402
|
+
|
403
|
+
|
404
|
+
</div>
|
405
|
+
</div>
|
406
|
+
<div class="tags">
|
407
|
+
|
408
|
+
|
409
|
+
</div><table class="source_code">
|
410
|
+
<tr>
|
411
|
+
<td>
|
412
|
+
<pre class="lines">
|
413
|
+
|
414
|
+
|
415
|
+
9
|
416
|
+
10
|
417
|
+
11</pre>
|
418
|
+
</td>
|
419
|
+
<td>
|
420
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 9</span>
|
421
|
+
|
422
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_query'>query</span>
|
423
|
+
<span class='ivar'>@query</span>
|
424
|
+
<span class='kw'>end</span></pre>
|
425
|
+
</td>
|
426
|
+
</tr>
|
427
|
+
</table>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
|
431
|
+
<span id="source=-instance_method"></span>
|
432
|
+
<span id="source-instance_method"></span>
|
433
|
+
<div class="method_details ">
|
434
|
+
<p class="signature " id="source-instance_method">
|
435
|
+
|
436
|
+
- (<tt>Object</tt>) <strong>source</strong>
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
</p><div class="docstring">
|
441
|
+
<div class="discussion">
|
442
|
+
<p>Returns the value of attribute source</p>
|
443
|
+
|
444
|
+
|
445
|
+
</div>
|
446
|
+
</div>
|
447
|
+
<div class="tags">
|
448
|
+
|
449
|
+
|
450
|
+
</div><table class="source_code">
|
451
|
+
<tr>
|
452
|
+
<td>
|
453
|
+
<pre class="lines">
|
454
|
+
|
455
|
+
|
456
|
+
9
|
457
|
+
10
|
458
|
+
11</pre>
|
459
|
+
</td>
|
460
|
+
<td>
|
461
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 9</span>
|
462
|
+
|
463
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_source'>source</span>
|
464
|
+
<span class='ivar'>@source</span>
|
465
|
+
<span class='kw'>end</span></pre>
|
466
|
+
</td>
|
467
|
+
</tr>
|
468
|
+
</table>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
|
472
|
+
<span id="values=-instance_method"></span>
|
473
|
+
<span id="values-instance_method"></span>
|
474
|
+
<div class="method_details ">
|
475
|
+
<p class="signature " id="values-instance_method">
|
476
|
+
|
477
|
+
- (<tt>Object</tt>) <strong>values</strong>
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
</p><div class="docstring">
|
482
|
+
<div class="discussion">
|
483
|
+
<p>Returns the value of attribute values</p>
|
484
|
+
|
485
|
+
|
486
|
+
</div>
|
487
|
+
</div>
|
488
|
+
<div class="tags">
|
489
|
+
|
490
|
+
|
491
|
+
</div><table class="source_code">
|
492
|
+
<tr>
|
493
|
+
<td>
|
494
|
+
<pre class="lines">
|
495
|
+
|
496
|
+
|
497
|
+
9
|
498
|
+
10
|
499
|
+
11</pre>
|
500
|
+
</td>
|
501
|
+
<td>
|
502
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 9</span>
|
503
|
+
|
504
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_values'>values</span>
|
505
|
+
<span class='ivar'>@values</span>
|
506
|
+
<span class='kw'>end</span></pre>
|
507
|
+
</td>
|
508
|
+
</tr>
|
509
|
+
</table>
|
510
|
+
</div>
|
511
|
+
|
512
|
+
</div>
|
513
|
+
|
514
|
+
|
515
|
+
<div id="instance_method_details" class="method_details_list">
|
516
|
+
<h2>Instance Method Details</h2>
|
517
|
+
|
518
|
+
|
519
|
+
<div class="method_details first">
|
520
|
+
<p class="signature first" id="all-instance_method">
|
521
|
+
|
522
|
+
- (<tt>Object</tt>) <strong>all</strong>
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
</p><div class="docstring">
|
527
|
+
<div class="discussion">
|
528
|
+
<p>Returns all the records matching the criteria.</p>
|
529
|
+
|
530
|
+
|
531
|
+
</div>
|
532
|
+
</div>
|
533
|
+
<div class="tags">
|
534
|
+
|
535
|
+
<h3>Since:</h3>
|
536
|
+
<ul class="since">
|
537
|
+
|
538
|
+
<li>
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
<div class='inline'><p>0.2.0</p>
|
545
|
+
</div>
|
546
|
+
|
547
|
+
</li>
|
548
|
+
|
549
|
+
</ul>
|
550
|
+
|
551
|
+
</div><table class="source_code">
|
552
|
+
<tr>
|
553
|
+
<td>
|
554
|
+
<pre class="lines">
|
555
|
+
|
556
|
+
|
557
|
+
39
|
558
|
+
40
|
559
|
+
41</pre>
|
560
|
+
</td>
|
561
|
+
<td>
|
562
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 39</span>
|
563
|
+
|
564
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span>
|
565
|
+
<span class='id identifier rubyid_records'>records</span>
|
566
|
+
<span class='kw'>end</span></pre>
|
567
|
+
</td>
|
568
|
+
</tr>
|
569
|
+
</table>
|
570
|
+
</div>
|
571
|
+
|
572
|
+
<div class="method_details ">
|
573
|
+
<p class="signature " id="each-instance_method">
|
574
|
+
|
575
|
+
- (<tt>Object</tt>) <strong>each</strong>(&block)
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
</p><div class="docstring">
|
580
|
+
<div class="discussion">
|
581
|
+
<p>Allows you to use the results of a search as an enumerable over the results found.</p>
|
582
|
+
|
583
|
+
|
584
|
+
</div>
|
585
|
+
</div>
|
586
|
+
<div class="tags">
|
587
|
+
|
588
|
+
<h3>Since:</h3>
|
589
|
+
<ul class="since">
|
590
|
+
|
591
|
+
<li>
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
<div class='inline'><p>0.2.0</p>
|
598
|
+
</div>
|
599
|
+
|
600
|
+
</li>
|
601
|
+
|
602
|
+
</ul>
|
603
|
+
|
604
|
+
</div><table class="source_code">
|
605
|
+
<tr>
|
606
|
+
<td>
|
607
|
+
<pre class="lines">
|
608
|
+
|
609
|
+
|
610
|
+
53
|
611
|
+
54
|
612
|
+
55</pre>
|
613
|
+
</td>
|
614
|
+
<td>
|
615
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 53</span>
|
616
|
+
|
617
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
618
|
+
<span class='id identifier rubyid_records'>records</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
619
|
+
<span class='kw'>end</span></pre>
|
620
|
+
</td>
|
621
|
+
</tr>
|
622
|
+
</table>
|
623
|
+
</div>
|
624
|
+
|
625
|
+
<div class="method_details ">
|
626
|
+
<p class="signature " id="first-instance_method">
|
627
|
+
|
628
|
+
- (<tt>Object</tt>) <strong>first</strong>
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
</p><div class="docstring">
|
633
|
+
<div class="discussion">
|
634
|
+
<p>Returns the first record matching the criteria.</p>
|
635
|
+
|
636
|
+
|
637
|
+
</div>
|
638
|
+
</div>
|
639
|
+
<div class="tags">
|
640
|
+
|
641
|
+
<h3>Since:</h3>
|
642
|
+
<ul class="since">
|
643
|
+
|
644
|
+
<li>
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
<div class='inline'><p>0.2.0</p>
|
651
|
+
</div>
|
652
|
+
|
653
|
+
</li>
|
654
|
+
|
655
|
+
</ul>
|
656
|
+
|
657
|
+
</div><table class="source_code">
|
658
|
+
<tr>
|
659
|
+
<td>
|
660
|
+
<pre class="lines">
|
661
|
+
|
662
|
+
|
663
|
+
46
|
664
|
+
47
|
665
|
+
48</pre>
|
666
|
+
</td>
|
667
|
+
<td>
|
668
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 46</span>
|
669
|
+
|
670
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_first'>first</span>
|
671
|
+
<span class='id identifier rubyid_records'>records</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
672
|
+
<span class='kw'>end</span></pre>
|
673
|
+
</td>
|
674
|
+
</tr>
|
675
|
+
</table>
|
676
|
+
</div>
|
677
|
+
|
678
|
+
<div class="method_details ">
|
679
|
+
<p class="signature " id="where-instance_method">
|
680
|
+
|
681
|
+
- (<tt>Object</tt>) <strong>where</strong>(args)
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
</p><div class="docstring">
|
686
|
+
<div class="discussion">
|
687
|
+
<p>The workhorse method of the criteria chain. Each key in the passed in hash will become another criteria that the
|
688
|
+
ultimate query must match. A key can either be a symbol or a string, and should be an attribute name or
|
689
|
+
an attribute name with a range operator.</p>
|
690
|
+
|
691
|
+
|
692
|
+
</div>
|
693
|
+
</div>
|
694
|
+
<div class="tags">
|
695
|
+
|
696
|
+
<div class="examples">
|
697
|
+
<h3>Examples:</h3>
|
698
|
+
|
699
|
+
<h4><div class='inline'><p>A simple criteria</p>
|
700
|
+
</div></h4>
|
701
|
+
<pre class="example code"><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Josh</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span></pre>
|
702
|
+
|
703
|
+
<h4><div class='inline'><p>A more complicated criteria</p>
|
704
|
+
</div></h4>
|
705
|
+
<pre class="example code"><span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Josh</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>created_at.gt</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='int'>1</span><span class='period'>.</span><span class='id identifier rubyid_day'>day</span><span class='rparen'>)</span></pre>
|
706
|
+
|
707
|
+
</div>
|
708
|
+
|
709
|
+
<h3>Since:</h3>
|
710
|
+
<ul class="since">
|
711
|
+
|
712
|
+
<li>
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
<div class='inline'><p>0.2.0</p>
|
719
|
+
</div>
|
720
|
+
|
721
|
+
</li>
|
722
|
+
|
723
|
+
</ul>
|
724
|
+
|
725
|
+
</div><table class="source_code">
|
726
|
+
<tr>
|
727
|
+
<td>
|
728
|
+
<pre class="lines">
|
729
|
+
|
730
|
+
|
731
|
+
31
|
732
|
+
32
|
733
|
+
33
|
734
|
+
34</pre>
|
735
|
+
</td>
|
736
|
+
<td>
|
737
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/criteria/chain.rb', line 31</span>
|
738
|
+
|
739
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_where'>where</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
740
|
+
<span class='id identifier rubyid_args'>args</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span>
|
741
|
+
<span class='kw'>self</span>
|
742
|
+
<span class='kw'>end</span></pre>
|
743
|
+
</td>
|
744
|
+
</tr>
|
745
|
+
</table>
|
746
|
+
</div>
|
747
|
+
|
748
|
+
</div>
|
749
|
+
|
750
|
+
</div>
|
751
|
+
|
752
|
+
<div id="footer">
|
753
|
+
Generated on Tue Mar 27 17:53:07 2012 by
|
754
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
755
|
+
0.7.5 (ruby-1.9.3).
|
756
|
+
</div>
|
757
|
+
|
758
|
+
</body>
|
759
|
+
</html>
|