adept_dynamoid 0.5.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Dynamoid.gemspec +193 -0
  4. data/Gemfile +23 -0
  5. data/Gemfile.lock +86 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.markdown +265 -0
  8. data/Rakefile +62 -0
  9. data/VERSION +1 -0
  10. data/doc/.nojekyll +0 -0
  11. data/doc/Dynamoid.html +312 -0
  12. data/doc/Dynamoid/Adapter.html +1385 -0
  13. data/doc/Dynamoid/Adapter/AwsSdk.html +1585 -0
  14. data/doc/Dynamoid/Adapter/Local.html +1574 -0
  15. data/doc/Dynamoid/Associations.html +131 -0
  16. data/doc/Dynamoid/Associations/Association.html +794 -0
  17. data/doc/Dynamoid/Associations/BelongsTo.html +158 -0
  18. data/doc/Dynamoid/Associations/ClassMethods.html +723 -0
  19. data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +164 -0
  20. data/doc/Dynamoid/Associations/HasMany.html +164 -0
  21. data/doc/Dynamoid/Associations/HasOne.html +158 -0
  22. data/doc/Dynamoid/Associations/ManyAssociation.html +1640 -0
  23. data/doc/Dynamoid/Associations/SingleAssociation.html +598 -0
  24. data/doc/Dynamoid/Components.html +204 -0
  25. data/doc/Dynamoid/Config.html +395 -0
  26. data/doc/Dynamoid/Config/Options.html +609 -0
  27. data/doc/Dynamoid/Criteria.html +131 -0
  28. data/doc/Dynamoid/Criteria/Chain.html +1063 -0
  29. data/doc/Dynamoid/Criteria/ClassMethods.html +98 -0
  30. data/doc/Dynamoid/Document.html +666 -0
  31. data/doc/Dynamoid/Document/ClassMethods.html +937 -0
  32. data/doc/Dynamoid/Errors.html +118 -0
  33. data/doc/Dynamoid/Errors/DocumentNotValid.html +210 -0
  34. data/doc/Dynamoid/Errors/Error.html +130 -0
  35. data/doc/Dynamoid/Errors/InvalidField.html +133 -0
  36. data/doc/Dynamoid/Errors/MissingRangeKey.html +133 -0
  37. data/doc/Dynamoid/Fields.html +669 -0
  38. data/doc/Dynamoid/Fields/ClassMethods.html +309 -0
  39. data/doc/Dynamoid/Finders.html +128 -0
  40. data/doc/Dynamoid/Finders/ClassMethods.html +516 -0
  41. data/doc/Dynamoid/Indexes.html +308 -0
  42. data/doc/Dynamoid/Indexes/ClassMethods.html +353 -0
  43. data/doc/Dynamoid/Indexes/Index.html +1104 -0
  44. data/doc/Dynamoid/Persistence.html +651 -0
  45. data/doc/Dynamoid/Persistence/ClassMethods.html +670 -0
  46. data/doc/Dynamoid/Validations.html +399 -0
  47. data/doc/_index.html +461 -0
  48. data/doc/class_list.html +47 -0
  49. data/doc/css/common.css +1 -0
  50. data/doc/css/full_list.css +55 -0
  51. data/doc/css/style.css +322 -0
  52. data/doc/file.LICENSE.html +66 -0
  53. data/doc/file.README.html +312 -0
  54. data/doc/file_list.html +52 -0
  55. data/doc/frames.html +13 -0
  56. data/doc/index.html +312 -0
  57. data/doc/js/app.js +205 -0
  58. data/doc/js/full_list.js +173 -0
  59. data/doc/js/jquery.js +16 -0
  60. data/doc/method_list.html +1238 -0
  61. data/doc/top-level-namespace.html +105 -0
  62. data/lib/dynamoid.rb +47 -0
  63. data/lib/dynamoid/adapter.rb +177 -0
  64. data/lib/dynamoid/adapter/aws_sdk.rb +223 -0
  65. data/lib/dynamoid/associations.rb +106 -0
  66. data/lib/dynamoid/associations/association.rb +105 -0
  67. data/lib/dynamoid/associations/belongs_to.rb +44 -0
  68. data/lib/dynamoid/associations/has_and_belongs_to_many.rb +40 -0
  69. data/lib/dynamoid/associations/has_many.rb +39 -0
  70. data/lib/dynamoid/associations/has_one.rb +39 -0
  71. data/lib/dynamoid/associations/many_association.rb +191 -0
  72. data/lib/dynamoid/associations/single_association.rb +69 -0
  73. data/lib/dynamoid/components.rb +36 -0
  74. data/lib/dynamoid/config.rb +57 -0
  75. data/lib/dynamoid/config/options.rb +78 -0
  76. data/lib/dynamoid/criteria.rb +29 -0
  77. data/lib/dynamoid/criteria/chain.rb +243 -0
  78. data/lib/dynamoid/dirty.rb +41 -0
  79. data/lib/dynamoid/document.rb +184 -0
  80. data/lib/dynamoid/errors.rb +28 -0
  81. data/lib/dynamoid/fields.rb +130 -0
  82. data/lib/dynamoid/finders.rb +131 -0
  83. data/lib/dynamoid/identity_map.rb +96 -0
  84. data/lib/dynamoid/indexes.rb +69 -0
  85. data/lib/dynamoid/indexes/index.rb +103 -0
  86. data/lib/dynamoid/middleware/identity_map.rb +16 -0
  87. data/lib/dynamoid/persistence.rb +247 -0
  88. data/lib/dynamoid/validations.rb +36 -0
  89. data/spec/app/models/address.rb +10 -0
  90. data/spec/app/models/camel_case.rb +24 -0
  91. data/spec/app/models/magazine.rb +11 -0
  92. data/spec/app/models/message.rb +9 -0
  93. data/spec/app/models/sponsor.rb +8 -0
  94. data/spec/app/models/subscription.rb +12 -0
  95. data/spec/app/models/tweet.rb +12 -0
  96. data/spec/app/models/user.rb +26 -0
  97. data/spec/dynamoid/adapter/aws_sdk_spec.rb +186 -0
  98. data/spec/dynamoid/adapter_spec.rb +117 -0
  99. data/spec/dynamoid/associations/association_spec.rb +194 -0
  100. data/spec/dynamoid/associations/belongs_to_spec.rb +71 -0
  101. data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +47 -0
  102. data/spec/dynamoid/associations/has_many_spec.rb +42 -0
  103. data/spec/dynamoid/associations/has_one_spec.rb +45 -0
  104. data/spec/dynamoid/associations_spec.rb +16 -0
  105. data/spec/dynamoid/config_spec.rb +27 -0
  106. data/spec/dynamoid/criteria/chain_spec.rb +140 -0
  107. data/spec/dynamoid/criteria_spec.rb +72 -0
  108. data/spec/dynamoid/dirty_spec.rb +49 -0
  109. data/spec/dynamoid/document_spec.rb +118 -0
  110. data/spec/dynamoid/fields_spec.rb +127 -0
  111. data/spec/dynamoid/finders_spec.rb +135 -0
  112. data/spec/dynamoid/identity_map_spec.rb +45 -0
  113. data/spec/dynamoid/indexes/index_spec.rb +104 -0
  114. data/spec/dynamoid/indexes_spec.rb +25 -0
  115. data/spec/dynamoid/persistence_spec.rb +176 -0
  116. data/spec/dynamoid/validations_spec.rb +36 -0
  117. data/spec/dynamoid_spec.rb +9 -0
  118. data/spec/spec_helper.rb +50 -0
  119. metadata +376 -0
@@ -0,0 +1,670 @@
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::Persistence::ClassMethods
8
+
9
+ &mdash; 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> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Persistence.html" title="Dynamoid::Persistence (module)">Persistence</a></span></span>
38
+ &raquo;
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::Persistence::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/persistence.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_table-instance_method" title="#create_table (instance method)">- (Object) <strong>create_table</strong>(options = {}) </a>
99
+
100
+
101
+
102
+ </span>
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <span class="summary_desc"><div class='inline'><p>Creates a table.</p>
112
+ </div></span>
113
+
114
+ </li>
115
+
116
+
117
+ <li class="public ">
118
+ <span class="summary_signature">
119
+
120
+ <a href="#table_exists%3F-instance_method" title="#table_exists? (instance method)">- (Boolean) <strong>table_exists?</strong>(table_name) </a>
121
+
122
+
123
+
124
+ </span>
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+ <span class="summary_desc"><div class='inline'><p>Does a table with this name exist?.</p>
134
+ </div></span>
135
+
136
+ </li>
137
+
138
+
139
+ <li class="public ">
140
+ <span class="summary_signature">
141
+
142
+ <a href="#table_name-instance_method" title="#table_name (instance method)">- (Object) <strong>table_name</strong> </a>
143
+
144
+
145
+
146
+ </span>
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+ <span class="summary_desc"><div class='inline'><p>Returns the name of the table the class is for.</p>
156
+ </div></span>
157
+
158
+ </li>
159
+
160
+
161
+ <li class="public ">
162
+ <span class="summary_signature">
163
+
164
+ <a href="#undump-instance_method" title="#undump (instance method)">- (Object) <strong>undump</strong>(incoming = nil) </a>
165
+
166
+
167
+
168
+ </span>
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+ <span class="summary_desc"><div class='inline'><p>Undump an object into a hash, converting each type from a string representation of itself into the type specified by the field.</p>
178
+ </div></span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#undump_field-instance_method" title="#undump_field (instance method)">- (Object) <strong>undump_field</strong>(value, type) </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+ <span class="summary_desc"><div class='inline'><p>Undump a value for a given type.</p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ </ul>
206
+
207
+
208
+
209
+
210
+ <div id="instance_method_details" class="method_details_list">
211
+ <h2>Instance Method Details</h2>
212
+
213
+
214
+ <div class="method_details first">
215
+ <p class="signature first" id="create_table-instance_method">
216
+
217
+ - (<tt>Object</tt>) <strong>create_table</strong>(options = {})
218
+
219
+
220
+
221
+ </p><div class="docstring">
222
+ <div class="discussion">
223
+ <p>Creates a table.</p>
224
+
225
+
226
+ </div>
227
+ </div>
228
+ <div class="tags">
229
+ <h3>Parameters:</h3>
230
+ <ul class="param">
231
+
232
+ <li>
233
+
234
+ <span class='name'>options</span>
235
+
236
+
237
+ <span class='type'>(<tt>Hash</tt>)</span>
238
+
239
+
240
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
241
+
242
+
243
+ &mdash;
244
+ <div class='inline'><p>options to pass for table creation</p>
245
+ </div>
246
+
247
+ </li>
248
+
249
+ </ul>
250
+
251
+
252
+
253
+
254
+ <h3>Options Hash (<tt>options</tt>):</h3>
255
+ <ul class="option">
256
+
257
+ <li>
258
+ <span class="name">:id</span>
259
+ <span class="type">(<tt>Symbol</tt>)</span>
260
+ <span class="default">
261
+
262
+ </span>
263
+ &mdash; <div class='inline'><p>the id field for the table</p>
264
+ </div>
265
+ </li>
266
+
267
+ <li>
268
+ <span class="name">:table_name</span>
269
+ <span class="type">(<tt>Symbol</tt>)</span>
270
+ <span class="default">
271
+
272
+ </span>
273
+ &mdash; <div class='inline'><p>the actual name for the table</p>
274
+ </div>
275
+ </li>
276
+
277
+ <li>
278
+ <span class="name">:read_capacity</span>
279
+ <span class="type">(<tt>Integer</tt>)</span>
280
+ <span class="default">
281
+
282
+ </span>
283
+ &mdash; <div class='inline'><p>set the read capacity for the table; does not work on existing tables</p>
284
+ </div>
285
+ </li>
286
+
287
+ <li>
288
+ <span class="name">:write_capacity</span>
289
+ <span class="type">(<tt>Integer</tt>)</span>
290
+ <span class="default">
291
+
292
+ </span>
293
+ &mdash; <div class='inline'><p>set the write capacity for the table; does not work on existing tables</p>
294
+ </div>
295
+ </li>
296
+
297
+ <li>
298
+ <span class="name">{range_key</span>
299
+ <span class="type">(<tt>Hash</tt>)</span>
300
+ <span class="default">
301
+
302
+ </span>
303
+ &mdash; <div class='inline'><p>=&gt; :type} a hash of the name of the range key and a symbol of its type</p>
304
+ </div>
305
+ </li>
306
+
307
+ </ul>
308
+
309
+
310
+ <h3>Since:</h3>
311
+ <ul class="since">
312
+
313
+ <li>
314
+
315
+
316
+
317
+
318
+
319
+ <div class='inline'><p>0.4.0</p>
320
+ </div>
321
+
322
+ </li>
323
+
324
+ </ul>
325
+
326
+ </div><table class="source_code">
327
+ <tr>
328
+ <td>
329
+ <pre class="lines">
330
+
331
+
332
+ 33
333
+ 34
334
+ 35
335
+ 36
336
+ 37
337
+ 38
338
+ 39
339
+ 40
340
+ 41
341
+ 42
342
+ 43
343
+ 44
344
+ 45</pre>
345
+ </td>
346
+ <td>
347
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 33</span>
348
+
349
+ <span class='kw'>def</span> <span class='id identifier rubyid_create_table'>create_table</span><span class='lparen'>(</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>
350
+ <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
351
+ <span class='symbol'>:id</span> <span class='op'>=&gt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span>
352
+ <span class='symbol'>:table_name</span> <span class='op'>=&gt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span>
353
+ <span class='symbol'>:write_capacity</span> <span class='op'>=&gt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_write_capacity'>write_capacity</span><span class='comma'>,</span>
354
+ <span class='symbol'>:read_capacity</span> <span class='op'>=&gt;</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read_capacity'>read_capacity</span><span class='comma'>,</span>
355
+ <span class='symbol'>:range_key</span> <span class='op'>=&gt;</span> <span class='kw'>self</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='id identifier rubyid_range_key'>range_key</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='rbrace'>}</span> <span class='op'>:</span> <span class='kw'>nil</span>
356
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
357
+
358
+ <span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_table_exists?'>table_exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:table_name</span><span class='rbracket'>]</span><span class='rparen'>)</span>
359
+
360
+ <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_tables'>tables</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:table_name</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_create_table'>create_table</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:table_name</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
361
+ <span class='kw'>end</span></pre>
362
+ </td>
363
+ </tr>
364
+ </table>
365
+ </div>
366
+
367
+ <div class="method_details ">
368
+ <p class="signature " id="table_exists?-instance_method">
369
+
370
+ - (<tt>Boolean</tt>) <strong>table_exists?</strong>(table_name)
371
+
372
+
373
+
374
+ </p><div class="docstring">
375
+ <div class="discussion">
376
+ <p>Does a table with this name exist?</p>
377
+
378
+
379
+ </div>
380
+ </div>
381
+ <div class="tags">
382
+
383
+ <h3>Returns:</h3>
384
+ <ul class="return">
385
+
386
+ <li>
387
+
388
+
389
+ <span class='type'>(<tt>Boolean</tt>)</span>
390
+
391
+
392
+
393
+ </li>
394
+
395
+ </ul>
396
+ <h3>Since:</h3>
397
+ <ul class="since">
398
+
399
+ <li>
400
+
401
+
402
+
403
+
404
+
405
+ <div class='inline'><p>0.2.0</p>
406
+ </div>
407
+
408
+ </li>
409
+
410
+ </ul>
411
+
412
+ </div><table class="source_code">
413
+ <tr>
414
+ <td>
415
+ <pre class="lines">
416
+
417
+
418
+ 50
419
+ 51
420
+ 52</pre>
421
+ </td>
422
+ <td>
423
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 50</span>
424
+
425
+ <span class='kw'>def</span> <span class='id identifier rubyid_table_exists?'>table_exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
426
+ <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Adapter</span><span class='period'>.</span><span class='id identifier rubyid_tables'>tables</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
427
+ <span class='kw'>end</span></pre>
428
+ </td>
429
+ </tr>
430
+ </table>
431
+ </div>
432
+
433
+ <div class="method_details ">
434
+ <p class="signature " id="table_name-instance_method">
435
+
436
+ - (<tt>Object</tt>) <strong>table_name</strong>
437
+
438
+
439
+
440
+ </p><div class="docstring">
441
+ <div class="discussion">
442
+ <p>Returns the name of the table the class is for.</p>
443
+
444
+
445
+ </div>
446
+ </div>
447
+ <div class="tags">
448
+
449
+ <h3>Since:</h3>
450
+ <ul class="since">
451
+
452
+ <li>
453
+
454
+
455
+
456
+
457
+
458
+ <div class='inline'><p>0.2.0</p>
459
+ </div>
460
+
461
+ </li>
462
+
463
+ </ul>
464
+
465
+ </div><table class="source_code">
466
+ <tr>
467
+ <td>
468
+ <pre class="lines">
469
+
470
+
471
+ 19
472
+ 20
473
+ 21</pre>
474
+ </td>
475
+ <td>
476
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 19</span>
477
+
478
+ <span class='kw'>def</span> <span class='id identifier rubyid_table_name'>table_name</span>
479
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_namespace'>namespace</span><span class='rbrace'>}</span><span class='tstring_content'>_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>: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'>:name</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span><span class='period'>.</span><span class='id identifier rubyid_pluralize'>pluralize</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
480
+ <span class='kw'>end</span></pre>
481
+ </td>
482
+ </tr>
483
+ </table>
484
+ </div>
485
+
486
+ <div class="method_details ">
487
+ <p class="signature " id="undump-instance_method">
488
+
489
+ - (<tt>Object</tt>) <strong>undump</strong>(incoming = nil)
490
+
491
+
492
+
493
+ </p><div class="docstring">
494
+ <div class="discussion">
495
+ <p>Undump an object into a hash, converting each type from a string representation of itself into the type specified by the field.</p>
496
+
497
+
498
+ </div>
499
+ </div>
500
+ <div class="tags">
501
+
502
+ <h3>Since:</h3>
503
+ <ul class="since">
504
+
505
+ <li>
506
+
507
+
508
+
509
+
510
+
511
+ <div class='inline'><p>0.2.0</p>
512
+ </div>
513
+
514
+ </li>
515
+
516
+ </ul>
517
+
518
+ </div><table class="source_code">
519
+ <tr>
520
+ <td>
521
+ <pre class="lines">
522
+
523
+
524
+ 57
525
+ 58
526
+ 59
527
+ 60
528
+ 61
529
+ 62
530
+ 63
531
+ 64
532
+ 65</pre>
533
+ </td>
534
+ <td>
535
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 57</span>
536
+
537
+ <span class='kw'>def</span> <span class='id identifier rubyid_undump'>undump</span><span class='lparen'>(</span><span class='id identifier rubyid_incoming'>incoming</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
538
+ <span class='id identifier rubyid_incoming'>incoming</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_incoming'>incoming</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span>
539
+ <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_tap'>tap</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_hash'>hash</span><span class='op'>|</span>
540
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</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_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>|</span>
541
+ <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_undump_field'>undump_field</span><span class='lparen'>(</span><span class='id identifier rubyid_incoming'>incoming</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span><span class='rparen'>)</span>
542
+ <span class='kw'>end</span>
543
+ <span class='id identifier rubyid_incoming'>incoming</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_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span>
544
+ <span class='kw'>end</span>
545
+ <span class='kw'>end</span></pre>
546
+ </td>
547
+ </tr>
548
+ </table>
549
+ </div>
550
+
551
+ <div class="method_details ">
552
+ <p class="signature " id="undump_field-instance_method">
553
+
554
+ - (<tt>Object</tt>) <strong>undump_field</strong>(value, type)
555
+
556
+
557
+
558
+ </p><div class="docstring">
559
+ <div class="discussion">
560
+ <p>Undump a value for a given type. Given a string, it'll determine (based on the type provided) whether to turn it into a
561
+ string, integer, float, set, array, datetime, or serialized return value.</p>
562
+
563
+
564
+ </div>
565
+ </div>
566
+ <div class="tags">
567
+
568
+ <h3>Since:</h3>
569
+ <ul class="since">
570
+
571
+ <li>
572
+
573
+
574
+
575
+
576
+
577
+ <div class='inline'><p>0.2.0</p>
578
+ </div>
579
+
580
+ </li>
581
+
582
+ </ul>
583
+
584
+ </div><table class="source_code">
585
+ <tr>
586
+ <td>
587
+ <pre class="lines">
588
+
589
+
590
+ 71
591
+ 72
592
+ 73
593
+ 74
594
+ 75
595
+ 76
596
+ 77
597
+ 78
598
+ 79
599
+ 80
600
+ 81
601
+ 82
602
+ 83
603
+ 84
604
+ 85
605
+ 86
606
+ 87
607
+ 88
608
+ 89
609
+ 90
610
+ 91
611
+ 92
612
+ 93
613
+ 94
614
+ 95
615
+ 96
616
+ 97
617
+ 98
618
+ 99
619
+ 100</pre>
620
+ </td>
621
+ <td>
622
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/persistence.rb', line 71</span>
623
+
624
+ <span class='kw'>def</span> <span class='id identifier rubyid_undump_field'>undump_field</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
625
+ <span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:empty?</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rparen'>)</span>
626
+
627
+ <span class='kw'>case</span> <span class='id identifier rubyid_type'>type</span>
628
+ <span class='kw'>when</span> <span class='symbol'>:string</span>
629
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
630
+ <span class='kw'>when</span> <span class='symbol'>:integer</span>
631
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
632
+ <span class='kw'>when</span> <span class='symbol'>:float</span>
633
+ <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span>
634
+ <span class='kw'>when</span> <span class='symbol'>:set</span><span class='comma'>,</span> <span class='symbol'>:array</span>
635
+ <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Set</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
636
+ <span class='id identifier rubyid_value'>value</span>
637
+ <span class='kw'>else</span>
638
+ <span class='const'>Set</span><span class='lbracket'>[</span><span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span>
639
+ <span class='kw'>end</span>
640
+ <span class='kw'>when</span> <span class='symbol'>:datetime</span>
641
+ <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Date</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>DateTime</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Time</span><span class='rparen'>)</span>
642
+ <span class='id identifier rubyid_value'>value</span>
643
+ <span class='kw'>else</span>
644
+ <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_datetime'>to_datetime</span>
645
+ <span class='kw'>end</span>
646
+ <span class='kw'>when</span> <span class='symbol'>:serialized</span>
647
+ <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
648
+ <span class='const'>YAML</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
649
+ <span class='kw'>else</span>
650
+ <span class='id identifier rubyid_value'>value</span>
651
+ <span class='kw'>end</span>
652
+ <span class='kw'>end</span>
653
+ <span class='kw'>end</span></pre>
654
+ </td>
655
+ </tr>
656
+ </table>
657
+ </div>
658
+
659
+ </div>
660
+
661
+ </div>
662
+
663
+ <div id="footer">
664
+ Generated on Thu Apr 26 01:26:25 2012 by
665
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
666
+ 0.7.5 (ruby-1.9.3).
667
+ </div>
668
+
669
+ </body>
670
+ </html>