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,308 @@
|
|
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::Indexes
|
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 (I)</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">Indexes</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::Indexes
|
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/indexes.rb<span class="defines">,<br />
|
84
|
+
lib/dynamoid/indexes/index.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>Indexes are quick ways of performing queries by anything other than id in DynamoDB. They are denormalized tables;
|
93
|
+
that is, data is duplicated in the initial table (where the object is saved) and the index table (where
|
94
|
+
we perform indexing).</p>
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
<div class="tags">
|
100
|
+
|
101
|
+
|
102
|
+
</div><h2>Defined Under Namespace</h2>
|
103
|
+
<p class="children">
|
104
|
+
|
105
|
+
|
106
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Indexes/ClassMethods.html" title="Dynamoid::Indexes::ClassMethods (module)">ClassMethods</a></span>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Indexes/Index.html" title="Dynamoid::Indexes::Index (class)">Index</a></span>
|
111
|
+
|
112
|
+
|
113
|
+
</p>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
<h2>
|
123
|
+
Instance Method Summary
|
124
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
125
|
+
</h2>
|
126
|
+
|
127
|
+
<ul class="summary">
|
128
|
+
|
129
|
+
<li class="public ">
|
130
|
+
<span class="summary_signature">
|
131
|
+
|
132
|
+
<a href="#delete_indexes-instance_method" title="#delete_indexes (instance method)">- (Object) <strong>delete_indexes</strong> </a>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
</span>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'><p>Callback for an object to delete itself from each of a class' indexes.</p>
|
146
|
+
</div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#save_indexes-instance_method" title="#save_indexes (instance method)">- (Object) <strong>save_indexes</strong> </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'><p>Callback for an object to save itself to each of a class' indexes.</p>
|
168
|
+
</div></span>
|
169
|
+
|
170
|
+
</li>
|
171
|
+
|
172
|
+
|
173
|
+
</ul>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<div id="instance_method_details" class="method_details_list">
|
180
|
+
<h2>Instance Method Details</h2>
|
181
|
+
|
182
|
+
|
183
|
+
<div class="method_details first">
|
184
|
+
<p class="signature first" id="delete_indexes-instance_method">
|
185
|
+
|
186
|
+
- (<tt>Object</tt>) <strong>delete_indexes</strong>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
</p><div class="docstring">
|
191
|
+
<div class="discussion">
|
192
|
+
<p>Callback for an object to delete itself from each of a class' indexes.</p>
|
193
|
+
|
194
|
+
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
<div class="tags">
|
198
|
+
|
199
|
+
<h3>Since:</h3>
|
200
|
+
<ul class="since">
|
201
|
+
|
202
|
+
<li>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div class='inline'><p>0.2.0</p>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</li>
|
212
|
+
|
213
|
+
</ul>
|
214
|
+
|
215
|
+
</div><table class="source_code">
|
216
|
+
<tr>
|
217
|
+
<td>
|
218
|
+
<pre class="lines">
|
219
|
+
|
220
|
+
|
221
|
+
61
|
222
|
+
62
|
223
|
+
63
|
224
|
+
64
|
225
|
+
65</pre>
|
226
|
+
</td>
|
227
|
+
<td>
|
228
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/indexes.rb', line 61</span>
|
229
|
+
|
230
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delete_indexes'>delete_indexes</span>
|
231
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_indexes'>indexes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
232
|
+
<span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
233
|
+
<span class='kw'>end</span>
|
234
|
+
<span class='kw'>end</span></pre>
|
235
|
+
</td>
|
236
|
+
</tr>
|
237
|
+
</table>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div class="method_details ">
|
241
|
+
<p class="signature " id="save_indexes-instance_method">
|
242
|
+
|
243
|
+
- (<tt>Object</tt>) <strong>save_indexes</strong>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
</p><div class="docstring">
|
248
|
+
<div class="discussion">
|
249
|
+
<p>Callback for an object to save itself to each of a class' indexes.</p>
|
250
|
+
|
251
|
+
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
<div class="tags">
|
255
|
+
|
256
|
+
<h3>Since:</h3>
|
257
|
+
<ul class="since">
|
258
|
+
|
259
|
+
<li>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<div class='inline'><p>0.2.0</p>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
</ul>
|
271
|
+
|
272
|
+
</div><table class="source_code">
|
273
|
+
<tr>
|
274
|
+
<td>
|
275
|
+
<pre class="lines">
|
276
|
+
|
277
|
+
|
278
|
+
52
|
279
|
+
53
|
280
|
+
54
|
281
|
+
55
|
282
|
+
56</pre>
|
283
|
+
</td>
|
284
|
+
<td>
|
285
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/indexes.rb', line 52</span>
|
286
|
+
|
287
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_save_indexes'>save_indexes</span>
|
288
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_indexes'>indexes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
289
|
+
<span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_save'>save</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
290
|
+
<span class='kw'>end</span>
|
291
|
+
<span class='kw'>end</span></pre>
|
292
|
+
</td>
|
293
|
+
</tr>
|
294
|
+
</table>
|
295
|
+
</div>
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div id="footer">
|
302
|
+
Generated on Tue Mar 27 17:53:06 2012 by
|
303
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
304
|
+
0.7.5 (ruby-1.9.3).
|
305
|
+
</div>
|
306
|
+
|
307
|
+
</body>
|
308
|
+
</html>
|
@@ -0,0 +1,351 @@
|
|
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::Indexes::ClassMethods
|
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="../Indexes.html" title="Dynamoid::Indexes (module)">Indexes</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">ClassMethods</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::Indexes::ClassMethods
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/dynamoid/indexes.rb</dd>
|
76
|
+
|
77
|
+
</dl>
|
78
|
+
<div class="clear"></div>
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
<h2>
|
89
|
+
Instance Method Summary
|
90
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
91
|
+
</h2>
|
92
|
+
|
93
|
+
<ul class="summary">
|
94
|
+
|
95
|
+
<li class="public ">
|
96
|
+
<span class="summary_signature">
|
97
|
+
|
98
|
+
<a href="#create_indexes-instance_method" title="#create_indexes (instance method)">- (Object) <strong>create_indexes</strong> </a>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
</span>
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<span class="summary_desc"><div class='inline'><p>Helper function to create indexes (if they don't exist already).</p>
|
112
|
+
</div></span>
|
113
|
+
|
114
|
+
</li>
|
115
|
+
|
116
|
+
|
117
|
+
<li class="public ">
|
118
|
+
<span class="summary_signature">
|
119
|
+
|
120
|
+
<a href="#find_index-instance_method" title="#find_index (instance method)">- (Object) <strong>find_index</strong>(index) </a>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</span>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="summary_desc"><div class='inline'><p>Helper function to find indexes.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#index-instance_method" title="#index (instance method)">- (Object) <strong>index</strong>(name, options = {}) </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<span class="summary_desc"><div class='inline'><p>The call to create an index.</p>
|
156
|
+
</div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<div id="instance_method_details" class="method_details_list">
|
167
|
+
<h2>Instance Method Details</h2>
|
168
|
+
|
169
|
+
|
170
|
+
<div class="method_details first">
|
171
|
+
<p class="signature first" id="create_indexes-instance_method">
|
172
|
+
|
173
|
+
- (<tt>Object</tt>) <strong>create_indexes</strong>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</p><div class="docstring">
|
178
|
+
<div class="discussion">
|
179
|
+
<p>Helper function to create indexes (if they don't exist already).</p>
|
180
|
+
|
181
|
+
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
<div class="tags">
|
185
|
+
|
186
|
+
<h3>Since:</h3>
|
187
|
+
<ul class="since">
|
188
|
+
|
189
|
+
<li>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<div class='inline'><p>0.2.0</p>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
</ul>
|
201
|
+
|
202
|
+
</div><table class="source_code">
|
203
|
+
<tr>
|
204
|
+
<td>
|
205
|
+
<pre class="lines">
|
206
|
+
|
207
|
+
|
208
|
+
41
|
209
|
+
42
|
210
|
+
43
|
211
|
+
44
|
212
|
+
45
|
213
|
+
46</pre>
|
214
|
+
</td>
|
215
|
+
<td>
|
216
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/indexes.rb', line 41</span>
|
217
|
+
|
218
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_indexes'>create_indexes</span>
|
219
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_indexes'>indexes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
220
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_range_key?'>range_key?</span> <span class='op'>?</span> <span class='lbrace'>{</span><span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='symbol'>:range</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
221
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_table'>create_table</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='symbol'>:id</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_table_exists?'>table_exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
222
|
+
<span class='kw'>end</span>
|
223
|
+
<span class='kw'>end</span></pre>
|
224
|
+
</td>
|
225
|
+
</tr>
|
226
|
+
</table>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
<div class="method_details ">
|
230
|
+
<p class="signature " id="find_index-instance_method">
|
231
|
+
|
232
|
+
- (<tt>Object</tt>) <strong>find_index</strong>(index)
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
</p><div class="docstring">
|
237
|
+
<div class="discussion">
|
238
|
+
<p>Helper function to find indexes.</p>
|
239
|
+
|
240
|
+
|
241
|
+
</div>
|
242
|
+
</div>
|
243
|
+
<div class="tags">
|
244
|
+
|
245
|
+
<h3>Since:</h3>
|
246
|
+
<ul class="since">
|
247
|
+
|
248
|
+
<li>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
<div class='inline'><p>0.2.0</p>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</li>
|
258
|
+
|
259
|
+
</ul>
|
260
|
+
|
261
|
+
</div><table class="source_code">
|
262
|
+
<tr>
|
263
|
+
<td>
|
264
|
+
<pre class="lines">
|
265
|
+
|
266
|
+
|
267
|
+
34
|
268
|
+
35
|
269
|
+
36</pre>
|
270
|
+
</td>
|
271
|
+
<td>
|
272
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/indexes.rb', line 34</span>
|
273
|
+
|
274
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_index'>find_index</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
275
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_indexes'>indexes</span><span class='lbracket'>[</span><span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_s</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:to_sym</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
276
|
+
<span class='kw'>end</span></pre>
|
277
|
+
</td>
|
278
|
+
</tr>
|
279
|
+
</table>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
<div class="method_details ">
|
283
|
+
<p class="signature " id="index-instance_method">
|
284
|
+
|
285
|
+
- (<tt>Object</tt>) <strong>index</strong>(name, options = {})
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
</p><div class="docstring">
|
290
|
+
<div class="discussion">
|
291
|
+
<p>The call to create an index. Generates a new index with the specified options -- for more information, see Dynamoid::Indexes::Index.
|
292
|
+
This function also attempts to immediately create the indexing table if it does not exist already.</p>
|
293
|
+
|
294
|
+
|
295
|
+
</div>
|
296
|
+
</div>
|
297
|
+
<div class="tags">
|
298
|
+
|
299
|
+
<h3>Since:</h3>
|
300
|
+
<ul class="since">
|
301
|
+
|
302
|
+
<li>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
<div class='inline'><p>0.2.0</p>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
</li>
|
312
|
+
|
313
|
+
</ul>
|
314
|
+
|
315
|
+
</div><table class="source_code">
|
316
|
+
<tr>
|
317
|
+
<td>
|
318
|
+
<pre class="lines">
|
319
|
+
|
320
|
+
|
321
|
+
25
|
322
|
+
26
|
323
|
+
27
|
324
|
+
28
|
325
|
+
29</pre>
|
326
|
+
</td>
|
327
|
+
<td>
|
328
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/indexes.rb', line 25</span>
|
329
|
+
|
330
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
331
|
+
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Indexes</span><span class='op'>::</span><span class='const'>Index</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
332
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_indexes'>indexes</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_index'>index</span>
|
333
|
+
<span class='id identifier rubyid_create_indexes'>create_indexes</span>
|
334
|
+
<span class='kw'>end</span></pre>
|
335
|
+
</td>
|
336
|
+
</tr>
|
337
|
+
</table>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div id="footer">
|
345
|
+
Generated on Tue Mar 27 17:53:06 2012 by
|
346
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
347
|
+
0.7.5 (ruby-1.9.3).
|
348
|
+
</div>
|
349
|
+
|
350
|
+
</body>
|
351
|
+
</html>
|