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,395 @@
|
|
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::Config
|
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">Config</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::Config
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<dt class="r1">Extended by:</dt>
|
70
|
+
<dd class="r1"><span class='object_link'><a href="" title="Dynamoid::Config (module)">Config</a></span>, <span class='object_link'><a href="Config/Options.html" title="Dynamoid::Config::Options (module)">Options</a></span></dd>
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
<dt class="r2">Includes:</dt>
|
76
|
+
<dd class="r2">ActiveModel::Observing</dd>
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1">Included in:</dt>
|
82
|
+
<dd class="r1"><span class='object_link'><a href="" title="Dynamoid::Config (module)">Config</a></span></dd>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<dt class="r2 last">Defined in:</dt>
|
87
|
+
<dd class="r2 last">lib/dynamoid/config.rb<span class="defines">,<br />
|
88
|
+
lib/dynamoid/config/options.rb</span>
|
89
|
+
</dd>
|
90
|
+
|
91
|
+
</dl>
|
92
|
+
<div class="clear"></div>
|
93
|
+
|
94
|
+
<h2>Overview</h2><div class="docstring">
|
95
|
+
<div class="discussion">
|
96
|
+
<p>Contains all the basic configuration information required for Dynamoid: both sensible defaults and required fields.</p>
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
<div class="tags">
|
102
|
+
|
103
|
+
|
104
|
+
</div><h2>Defined Under Namespace</h2>
|
105
|
+
<p class="children">
|
106
|
+
|
107
|
+
|
108
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Config/Options.html" title="Dynamoid::Config::Options (module)">Options</a></span>
|
109
|
+
|
110
|
+
|
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="#default_logger-instance_method" title="#default_logger (instance method)">- (Object) <strong>default_logger</strong> </a>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
</span>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<span class="summary_desc"><div class='inline'><p>The default logger for Dynamoid: either the Rails logger or just stdout.</p>
|
146
|
+
</div></span>
|
147
|
+
|
148
|
+
</li>
|
149
|
+
|
150
|
+
|
151
|
+
<li class="public ">
|
152
|
+
<span class="summary_signature">
|
153
|
+
|
154
|
+
<a href="#logger-instance_method" title="#logger (instance method)">- (Object) <strong>logger</strong> </a>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'><p>Returns the assigned logger instance.</p>
|
168
|
+
</div></span>
|
169
|
+
|
170
|
+
</li>
|
171
|
+
|
172
|
+
|
173
|
+
<li class="public ">
|
174
|
+
<span class="summary_signature">
|
175
|
+
|
176
|
+
<a href="#logger%3D-instance_method" title="#logger= (instance method)">- (Object) <strong>logger=</strong>(logger) </a>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
</span>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'><p>If you want to, set the logger manually to any output you'd like.</p>
|
190
|
+
</div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
</ul>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Config/Options.html" title="Dynamoid::Config::Options (module)">Options</a></span></h3>
|
207
|
+
<p class="inherited"><span class='object_link'><a href="Config/Options.html#defaults-instance_method" title="Dynamoid::Config::Options#defaults (method)">defaults</a></span>, <span class='object_link'><a href="Config/Options.html#option-instance_method" title="Dynamoid::Config::Options#option (method)">option</a></span>, <span class='object_link'><a href="Config/Options.html#reset-instance_method" title="Dynamoid::Config::Options#reset (method)">reset</a></span>, <span class='object_link'><a href="Config/Options.html#settings-instance_method" title="Dynamoid::Config::Options#settings (method)">settings</a></span></p>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<div id="instance_method_details" class="method_details_list">
|
212
|
+
<h2>Instance Method Details</h2>
|
213
|
+
|
214
|
+
|
215
|
+
<div class="method_details first">
|
216
|
+
<p class="signature first" id="default_logger-instance_method">
|
217
|
+
|
218
|
+
- (<tt>Object</tt>) <strong>default_logger</strong>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
</p><div class="docstring">
|
223
|
+
<div class="discussion">
|
224
|
+
<p>The default logger for Dynamoid: either the Rails logger or just stdout.</p>
|
225
|
+
|
226
|
+
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
<div class="tags">
|
230
|
+
|
231
|
+
<h3>Since:</h3>
|
232
|
+
<ul class="since">
|
233
|
+
|
234
|
+
<li>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<div class='inline'><p>0.2.0</p>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
</li>
|
244
|
+
|
245
|
+
</ul>
|
246
|
+
|
247
|
+
</div><table class="source_code">
|
248
|
+
<tr>
|
249
|
+
<td>
|
250
|
+
<pre class="lines">
|
251
|
+
|
252
|
+
|
253
|
+
29
|
254
|
+
30
|
255
|
+
31</pre>
|
256
|
+
</td>
|
257
|
+
<td>
|
258
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config.rb', line 29</span>
|
259
|
+
|
260
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_default_logger'>default_logger</span>
|
261
|
+
<span class='kw'>defined?</span><span class='lparen'>(</span><span class='const'>Rails</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:logger</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>Rails</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span> <span class='op'>:</span> <span class='op'>::</span><span class='const'>Logger</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='gvar'>$stdout</span><span class='rparen'>)</span>
|
262
|
+
<span class='kw'>end</span></pre>
|
263
|
+
</td>
|
264
|
+
</tr>
|
265
|
+
</table>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div class="method_details ">
|
269
|
+
<p class="signature " id="logger-instance_method">
|
270
|
+
|
271
|
+
- (<tt>Object</tt>) <strong>logger</strong>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
</p><div class="docstring">
|
276
|
+
<div class="discussion">
|
277
|
+
<p>Returns the assigned logger instance.</p>
|
278
|
+
|
279
|
+
|
280
|
+
</div>
|
281
|
+
</div>
|
282
|
+
<div class="tags">
|
283
|
+
|
284
|
+
<h3>Since:</h3>
|
285
|
+
<ul class="since">
|
286
|
+
|
287
|
+
<li>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<div class='inline'><p>0.2.0</p>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
</li>
|
297
|
+
|
298
|
+
</ul>
|
299
|
+
|
300
|
+
</div><table class="source_code">
|
301
|
+
<tr>
|
302
|
+
<td>
|
303
|
+
<pre class="lines">
|
304
|
+
|
305
|
+
|
306
|
+
36
|
307
|
+
37
|
308
|
+
38</pre>
|
309
|
+
</td>
|
310
|
+
<td>
|
311
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config.rb', line 36</span>
|
312
|
+
|
313
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span>
|
314
|
+
<span class='ivar'>@logger</span> <span class='op'>||=</span> <span class='id identifier rubyid_default_logger'>default_logger</span>
|
315
|
+
<span class='kw'>end</span></pre>
|
316
|
+
</td>
|
317
|
+
</tr>
|
318
|
+
</table>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div class="method_details ">
|
322
|
+
<p class="signature " id="logger=-instance_method">
|
323
|
+
|
324
|
+
- (<tt>Object</tt>) <strong>logger=</strong>(logger)
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</p><div class="docstring">
|
329
|
+
<div class="discussion">
|
330
|
+
<p>If you want to, set the logger manually to any output you'd like. Or pass false or nil to disable logging entirely.</p>
|
331
|
+
|
332
|
+
|
333
|
+
</div>
|
334
|
+
</div>
|
335
|
+
<div class="tags">
|
336
|
+
|
337
|
+
<h3>Since:</h3>
|
338
|
+
<ul class="since">
|
339
|
+
|
340
|
+
<li>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<div class='inline'><p>0.2.0</p>
|
347
|
+
</div>
|
348
|
+
|
349
|
+
</li>
|
350
|
+
|
351
|
+
</ul>
|
352
|
+
|
353
|
+
</div><table class="source_code">
|
354
|
+
<tr>
|
355
|
+
<td>
|
356
|
+
<pre class="lines">
|
357
|
+
|
358
|
+
|
359
|
+
43
|
360
|
+
44
|
361
|
+
45
|
362
|
+
46
|
363
|
+
47
|
364
|
+
48
|
365
|
+
49
|
366
|
+
50</pre>
|
367
|
+
</td>
|
368
|
+
<td>
|
369
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config.rb', line 43</span>
|
370
|
+
|
371
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_logger='>logger=</span><span class='lparen'>(</span><span class='id identifier rubyid_logger'>logger</span><span class='rparen'>)</span>
|
372
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_logger'>logger</span>
|
373
|
+
<span class='kw'>when</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>nil</span> <span class='kw'>then</span> <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
374
|
+
<span class='kw'>when</span> <span class='kw'>true</span> <span class='kw'>then</span> <span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_default_logger'>default_logger</span>
|
375
|
+
<span class='kw'>else</span>
|
376
|
+
<span class='ivar'>@logger</span> <span class='op'>=</span> <span class='id identifier rubyid_logger'>logger</span> <span class='kw'>if</span> <span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:info</span><span class='rparen'>)</span>
|
377
|
+
<span class='kw'>end</span>
|
378
|
+
<span class='kw'>end</span></pre>
|
379
|
+
</td>
|
380
|
+
</tr>
|
381
|
+
</table>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
</div>
|
385
|
+
|
386
|
+
</div>
|
387
|
+
|
388
|
+
<div id="footer">
|
389
|
+
Generated on Tue Mar 27 17:53:05 2012 by
|
390
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
391
|
+
0.7.5 (ruby-1.9.3).
|
392
|
+
</div>
|
393
|
+
|
394
|
+
</body>
|
395
|
+
</html>
|
@@ -0,0 +1,609 @@
|
|
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::Config::Options
|
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 (O)</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="../Config.html" title="Dynamoid::Config (module)">Config</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">Options</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::Config::Options
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<dt class="r1">Included in:</dt>
|
74
|
+
<dd class="r1"><span class='object_link'><a href="../Config.html" title="Dynamoid::Config (module)">Dynamoid::Config</a></span></dd>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<dt class="r2 last">Defined in:</dt>
|
79
|
+
<dd class="r2 last">lib/dynamoid/config/options.rb</dd>
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Overview</h2><div class="docstring">
|
85
|
+
<div class="discussion">
|
86
|
+
<p>Encapsulates logic for setting options.</p>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
<div class="tags">
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<h2>
|
103
|
+
Instance Method Summary
|
104
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
105
|
+
</h2>
|
106
|
+
|
107
|
+
<ul class="summary">
|
108
|
+
|
109
|
+
<li class="public ">
|
110
|
+
<span class="summary_signature">
|
111
|
+
|
112
|
+
<a href="#defaults-instance_method" title="#defaults (instance method)">- (Hash) <strong>defaults</strong> </a>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
</span>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<span class="summary_desc"><div class='inline'><p>Get the defaults or initialize a new empty hash.</p>
|
126
|
+
</div></span>
|
127
|
+
|
128
|
+
</li>
|
129
|
+
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#option-instance_method" title="#option (instance method)">- (Object) <strong>option</strong>(name, options = {}) </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'><p>Define a configuration option with a default.</p>
|
148
|
+
</div></span>
|
149
|
+
|
150
|
+
</li>
|
151
|
+
|
152
|
+
|
153
|
+
<li class="public ">
|
154
|
+
<span class="summary_signature">
|
155
|
+
|
156
|
+
<a href="#reset-instance_method" title="#reset (instance method)">- (Hash) <strong>reset</strong> </a>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
</span>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<span class="summary_desc"><div class='inline'><p>Reset the configuration options to the defaults.</p>
|
170
|
+
</div></span>
|
171
|
+
|
172
|
+
</li>
|
173
|
+
|
174
|
+
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
177
|
+
|
178
|
+
<a href="#settings-instance_method" title="#settings (instance method)">- (Hash) <strong>settings</strong> </a>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<span class="summary_desc"><div class='inline'><p>Get the settings or initialize a new empty hash.</p>
|
192
|
+
</div></span>
|
193
|
+
|
194
|
+
</li>
|
195
|
+
|
196
|
+
|
197
|
+
</ul>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<div id="instance_method_details" class="method_details_list">
|
203
|
+
<h2>Instance Method Details</h2>
|
204
|
+
|
205
|
+
|
206
|
+
<div class="method_details first">
|
207
|
+
<p class="signature first" id="defaults-instance_method">
|
208
|
+
|
209
|
+
- (<tt>Hash</tt>) <strong>defaults</strong>
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
</p><div class="docstring">
|
214
|
+
<div class="discussion">
|
215
|
+
<p>Get the defaults or initialize a new empty hash.</p>
|
216
|
+
|
217
|
+
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
<div class="tags">
|
221
|
+
|
222
|
+
<div class="examples">
|
223
|
+
<h3>Examples:</h3>
|
224
|
+
|
225
|
+
<h4><div class='inline'><p>Get the defaults.</p>
|
226
|
+
</div></h4>
|
227
|
+
<pre class="example code"><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_defaults'>defaults</span></pre>
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<h3>Returns:</h3>
|
232
|
+
<ul class="return">
|
233
|
+
|
234
|
+
<li>
|
235
|
+
|
236
|
+
|
237
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
—
|
242
|
+
<div class='inline'><p>The default options.</p>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
</li>
|
246
|
+
|
247
|
+
</ul>
|
248
|
+
<h3>Since:</h3>
|
249
|
+
<ul class="since">
|
250
|
+
|
251
|
+
<li>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
<div class='inline'><p>0.2.0</p>
|
258
|
+
</div>
|
259
|
+
|
260
|
+
</li>
|
261
|
+
|
262
|
+
</ul>
|
263
|
+
|
264
|
+
</div><table class="source_code">
|
265
|
+
<tr>
|
266
|
+
<td>
|
267
|
+
<pre class="lines">
|
268
|
+
|
269
|
+
|
270
|
+
16
|
271
|
+
17
|
272
|
+
18</pre>
|
273
|
+
</td>
|
274
|
+
<td>
|
275
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config/options.rb', line 16</span>
|
276
|
+
|
277
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_defaults'>defaults</span>
|
278
|
+
<span class='ivar'>@defaults</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
279
|
+
<span class='kw'>end</span></pre>
|
280
|
+
</td>
|
281
|
+
</tr>
|
282
|
+
</table>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method_details ">
|
286
|
+
<p class="signature " id="option-instance_method">
|
287
|
+
|
288
|
+
- (<tt>Object</tt>) <strong>option</strong>(name, options = {})
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
</p><div class="docstring">
|
293
|
+
<div class="discussion">
|
294
|
+
<p>Define a configuration option with a default.</p>
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
<div class="tags">
|
300
|
+
|
301
|
+
<div class="examples">
|
302
|
+
<h3>Examples:</h3>
|
303
|
+
|
304
|
+
<h4><div class='inline'><p>Define the option.</p>
|
305
|
+
</div></h4>
|
306
|
+
<pre class="example code"><span class='const'>Options</span><span class='period'>.</span><span class='id identifier rubyid_option'>option</span><span class='lparen'>(</span><span class='symbol'>:persist_in_safe_mode</span><span class='comma'>,</span> <span class='symbol'>:default</span> <span class='op'>=></span> <span class='kw'>false</span><span class='rparen'>)</span></pre>
|
307
|
+
|
308
|
+
</div>
|
309
|
+
<h3>Parameters:</h3>
|
310
|
+
<ul class="param">
|
311
|
+
|
312
|
+
<li>
|
313
|
+
|
314
|
+
<span class='name'>name</span>
|
315
|
+
|
316
|
+
|
317
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
—
|
322
|
+
<div class='inline'><p>The name of the configuration option.</p>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</li>
|
326
|
+
|
327
|
+
<li>
|
328
|
+
|
329
|
+
<span class='name'>options</span>
|
330
|
+
|
331
|
+
|
332
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
333
|
+
|
334
|
+
|
335
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
336
|
+
|
337
|
+
|
338
|
+
—
|
339
|
+
<div class='inline'><p>Extras for the option.</p>
|
340
|
+
</div>
|
341
|
+
|
342
|
+
</li>
|
343
|
+
|
344
|
+
</ul>
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<h3>Options Hash (<tt>options</tt>):</h3>
|
352
|
+
<ul class="option">
|
353
|
+
|
354
|
+
<li>
|
355
|
+
<span class="name">:default</span>
|
356
|
+
<span class="type">(<tt>Object</tt>)</span>
|
357
|
+
<span class="default">
|
358
|
+
|
359
|
+
</span>
|
360
|
+
— <div class='inline'><p>The default value.</p>
|
361
|
+
</div>
|
362
|
+
</li>
|
363
|
+
|
364
|
+
</ul>
|
365
|
+
|
366
|
+
|
367
|
+
<h3>Since:</h3>
|
368
|
+
<ul class="since">
|
369
|
+
|
370
|
+
<li>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
<div class='inline'><p>0.2.0</p>
|
377
|
+
</div>
|
378
|
+
|
379
|
+
</li>
|
380
|
+
|
381
|
+
</ul>
|
382
|
+
|
383
|
+
</div><table class="source_code">
|
384
|
+
<tr>
|
385
|
+
<td>
|
386
|
+
<pre class="lines">
|
387
|
+
|
388
|
+
|
389
|
+
31
|
390
|
+
32
|
391
|
+
33
|
392
|
+
34
|
393
|
+
35
|
394
|
+
36
|
395
|
+
37
|
396
|
+
38
|
397
|
+
39
|
398
|
+
40
|
399
|
+
41
|
400
|
+
42
|
401
|
+
43
|
402
|
+
44
|
403
|
+
45
|
404
|
+
46
|
405
|
+
47
|
406
|
+
48
|
407
|
+
49
|
408
|
+
50
|
409
|
+
51</pre>
|
410
|
+
</td>
|
411
|
+
<td>
|
412
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config/options.rb', line 31</span>
|
413
|
+
|
414
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_option'>option</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>
|
415
|
+
<span class='id identifier rubyid_defaults'>defaults</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_settings'>settings</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:default</span><span class='rbracket'>]</span>
|
416
|
+
|
417
|
+
<span class='id identifier rubyid_class_eval'>class_eval</span> <span class='heredoc_beg'><<-RUBY</span>
|
418
|
+
<span class='tstring_content'> def </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>
|
419
|
+
</span><span class='embexpr_beg'> settings[#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'>]
|
420
|
+
end
|
421
|
+
|
422
|
+
</span><span class='embexpr_beg'> def #{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>=(value)
|
423
|
+
</span><span class='embexpr_beg'> settings[#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'>] = value
|
424
|
+
end
|
425
|
+
|
426
|
+
</span><span class='embexpr_beg'> def #{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>?
|
427
|
+
</span><span class='embexpr_beg'> #{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>
|
428
|
+
end
|
429
|
+
|
430
|
+
</span><span class='embexpr_beg'> def reset_#{</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>
|
431
|
+
</span><span class='embexpr_beg'> settings[#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'>] = defaults[</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='rbrace'>}</span><span class='tstring_content'>]
|
432
|
+
end
|
433
|
+
</span><span class='heredoc_end'> RUBY
|
434
|
+
</span><span class='kw'>end</span></pre>
|
435
|
+
</td>
|
436
|
+
</tr>
|
437
|
+
</table>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div class="method_details ">
|
441
|
+
<p class="signature " id="reset-instance_method">
|
442
|
+
|
443
|
+
- (<tt>Hash</tt>) <strong>reset</strong>
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
</p><div class="docstring">
|
448
|
+
<div class="discussion">
|
449
|
+
<p>Reset the configuration options to the defaults.</p>
|
450
|
+
|
451
|
+
|
452
|
+
</div>
|
453
|
+
</div>
|
454
|
+
<div class="tags">
|
455
|
+
|
456
|
+
<div class="examples">
|
457
|
+
<h3>Examples:</h3>
|
458
|
+
|
459
|
+
<h4><div class='inline'><p>Reset the configuration options.</p>
|
460
|
+
</div></h4>
|
461
|
+
<pre class="example code"><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span></pre>
|
462
|
+
|
463
|
+
</div>
|
464
|
+
|
465
|
+
<h3>Returns:</h3>
|
466
|
+
<ul class="return">
|
467
|
+
|
468
|
+
<li>
|
469
|
+
|
470
|
+
|
471
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
—
|
476
|
+
<div class='inline'><p>The defaults.</p>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
</li>
|
480
|
+
|
481
|
+
</ul>
|
482
|
+
<h3>Since:</h3>
|
483
|
+
<ul class="since">
|
484
|
+
|
485
|
+
<li>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
<div class='inline'><p>0.2.0</p>
|
492
|
+
</div>
|
493
|
+
|
494
|
+
</li>
|
495
|
+
|
496
|
+
</ul>
|
497
|
+
|
498
|
+
</div><table class="source_code">
|
499
|
+
<tr>
|
500
|
+
<td>
|
501
|
+
<pre class="lines">
|
502
|
+
|
503
|
+
|
504
|
+
61
|
505
|
+
62
|
506
|
+
63</pre>
|
507
|
+
</td>
|
508
|
+
<td>
|
509
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config/options.rb', line 61</span>
|
510
|
+
|
511
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
|
512
|
+
<span class='id identifier rubyid_settings'>settings</span><span class='period'>.</span><span class='id identifier rubyid_replace'>replace</span><span class='lparen'>(</span><span class='id identifier rubyid_defaults'>defaults</span><span class='rparen'>)</span>
|
513
|
+
<span class='kw'>end</span></pre>
|
514
|
+
</td>
|
515
|
+
</tr>
|
516
|
+
</table>
|
517
|
+
</div>
|
518
|
+
|
519
|
+
<div class="method_details ">
|
520
|
+
<p class="signature " id="settings-instance_method">
|
521
|
+
|
522
|
+
- (<tt>Hash</tt>) <strong>settings</strong>
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
</p><div class="docstring">
|
527
|
+
<div class="discussion">
|
528
|
+
<p>Get the settings or initialize a new empty hash.</p>
|
529
|
+
|
530
|
+
|
531
|
+
</div>
|
532
|
+
</div>
|
533
|
+
<div class="tags">
|
534
|
+
|
535
|
+
<div class="examples">
|
536
|
+
<h3>Examples:</h3>
|
537
|
+
|
538
|
+
<h4><div class='inline'><p>Get the settings.</p>
|
539
|
+
</div></h4>
|
540
|
+
<pre class="example code"><span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_settings'>settings</span></pre>
|
541
|
+
|
542
|
+
</div>
|
543
|
+
|
544
|
+
<h3>Returns:</h3>
|
545
|
+
<ul class="return">
|
546
|
+
|
547
|
+
<li>
|
548
|
+
|
549
|
+
|
550
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
—
|
555
|
+
<div class='inline'><p>The setting options.</p>
|
556
|
+
</div>
|
557
|
+
|
558
|
+
</li>
|
559
|
+
|
560
|
+
</ul>
|
561
|
+
<h3>Since:</h3>
|
562
|
+
<ul class="since">
|
563
|
+
|
564
|
+
<li>
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
<div class='inline'><p>0.2.0</p>
|
571
|
+
</div>
|
572
|
+
|
573
|
+
</li>
|
574
|
+
|
575
|
+
</ul>
|
576
|
+
|
577
|
+
</div><table class="source_code">
|
578
|
+
<tr>
|
579
|
+
<td>
|
580
|
+
<pre class="lines">
|
581
|
+
|
582
|
+
|
583
|
+
73
|
584
|
+
74
|
585
|
+
75</pre>
|
586
|
+
</td>
|
587
|
+
<td>
|
588
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/config/options.rb', line 73</span>
|
589
|
+
|
590
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_settings'>settings</span>
|
591
|
+
<span class='ivar'>@settings</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
592
|
+
<span class='kw'>end</span></pre>
|
593
|
+
</td>
|
594
|
+
</tr>
|
595
|
+
</table>
|
596
|
+
</div>
|
597
|
+
|
598
|
+
</div>
|
599
|
+
|
600
|
+
</div>
|
601
|
+
|
602
|
+
<div id="footer">
|
603
|
+
Generated on Tue Mar 27 17:53:07 2012 by
|
604
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
605
|
+
0.7.5 (ruby-1.9.3).
|
606
|
+
</div>
|
607
|
+
|
608
|
+
</body>
|
609
|
+
</html>
|