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,98 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Dynamoid::Criteria::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="../Criteria.html" title="Dynamoid::Criteria (module)">Criteria</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::Criteria::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/criteria.rb</dd>
76
+
77
+ </dl>
78
+ <div class="clear"></div>
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+ </div>
90
+
91
+ <div id="footer">
92
+ Generated on Thu Apr 26 01:26:24 2012 by
93
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
94
+ 0.7.5 (ruby-1.9.3).
95
+ </div>
96
+
97
+ </body>
98
+ </html>
@@ -0,0 +1,666 @@
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::Document
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 (D)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
38
+ &raquo;
39
+ <span class="title">Document</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::Document
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
+ <dt class="r2">Includes:</dt>
76
+ <dd class="r2"><span class='object_link'><a href="Components.html" title="Dynamoid::Components (module)">Components</a></span></dd>
77
+
78
+
79
+
80
+
81
+
82
+ <dt class="r1 last">Defined in:</dt>
83
+ <dd class="r1 last">lib/dynamoid/document.rb</dd>
84
+
85
+ </dl>
86
+ <div class="clear"></div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+ <p>This is the base module for all domain objects that need to be persisted to
91
+ the database as documents.</p>
92
+
93
+
94
+ </div>
95
+ </div>
96
+ <div class="tags">
97
+
98
+
99
+ </div><h2>Defined Under Namespace</h2>
100
+ <p class="children">
101
+
102
+
103
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Document/ClassMethods.html" title="Dynamoid::Document::ClassMethods (module)">ClassMethods</a></span>
104
+
105
+
106
+
107
+
108
+ </p>
109
+
110
+
111
+
112
+
113
+
114
+
115
+ <h2>Instance Attribute Summary</h2>
116
+
117
+ <h3 class="inherited">Attributes included from <span class='object_link'><a href="Persistence.html" title="Dynamoid::Persistence (module)">Persistence</a></span></h3>
118
+ <p class="inherited"><span class='object_link'><a href="Persistence.html#new_record-instance_method" title="Dynamoid::Persistence#new_record (method)">#new_record</a></span></p>
119
+
120
+
121
+
122
+ <h3 class="inherited">Attributes included from <span class='object_link'><a href="Fields.html" title="Dynamoid::Fields (module)">Fields</a></span></h3>
123
+ <p class="inherited"><span class='object_link'><a href="Fields.html#attributes-instance_method" title="Dynamoid::Fields#attributes (method)">#attributes</a></span></p>
124
+
125
+
126
+
127
+ <h2>
128
+ Instance Method Summary
129
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
130
+ </h2>
131
+
132
+ <ul class="summary">
133
+
134
+ <li class="public ">
135
+ <span class="summary_signature">
136
+
137
+ <a href="#%3D%3D-instance_method" title="#== (instance method)">- (Object) <strong>==</strong>(other) </a>
138
+
139
+
140
+
141
+ </span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <span class="summary_desc"><div class='inline'><p>An object is equal to another object if their ids are equal.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#hash_key-instance_method" title="#hash_key (instance method)">- (Object) <strong>hash_key</strong> </a>
160
+
161
+
162
+
163
+ </span>
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+ <span class="summary_desc"><div class='inline'><p>Return an object's hash key, regardless of what it might be called to the object.</p>
173
+ </div></span>
174
+
175
+ </li>
176
+
177
+
178
+ <li class="public ">
179
+ <span class="summary_signature">
180
+
181
+ <a href="#hash_key%3D-instance_method" title="#hash_key= (instance method)">- (Object) <strong>hash_key=</strong>(key) </a>
182
+
183
+
184
+
185
+ </span>
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <span class="summary_desc"><div class='inline'><p>Assign an object's hash key, regardless of what it might be called to the object.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Dynamoid::Document) <strong>initialize</strong>(attrs = {}) </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+ <span class="summary_desc"><div class='inline'><p>Initialize a new object.</p>
217
+ </div></span>
218
+
219
+ </li>
220
+
221
+
222
+ <li class="public ">
223
+ <span class="summary_signature">
224
+
225
+ <a href="#reload-instance_method" title="#reload (instance method)">- (Dynamoid::Document) <strong>reload</strong> </a>
226
+
227
+
228
+
229
+ </span>
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+ <span class="summary_desc"><div class='inline'><p>Reload an object from the database -- if you suspect the object has changed in the datastore and you need those
239
+ changes to be reflected immediately, you would call this method.</p>
240
+ </div></span>
241
+
242
+ </li>
243
+
244
+
245
+ </ul>
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Validations.html" title="Dynamoid::Validations (module)">Validations</a></span></h3>
264
+ <p class="inherited"><span class='object_link'><a href="Validations.html#save-instance_method" title="Dynamoid::Validations#save (method)">#save</a></span>, <span class='object_link'><a href="Validations.html#save%21-instance_method" title="Dynamoid::Validations#save! (method)">#save!</a></span>, <span class='object_link'><a href="Validations.html#valid%3F-instance_method" title="Dynamoid::Validations#valid? (method)">#valid?</a></span></p>
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Persistence.html" title="Dynamoid::Persistence (module)">Persistence</a></span></h3>
295
+ <p class="inherited"><span class='object_link'><a href="Persistence.html#delete-instance_method" title="Dynamoid::Persistence#delete (method)">#delete</a></span>, <span class='object_link'><a href="Persistence.html#destroy-instance_method" title="Dynamoid::Persistence#destroy (method)">#destroy</a></span>, <span class='object_link'><a href="Persistence.html#dump-instance_method" title="Dynamoid::Persistence#dump (method)">#dump</a></span>, <span class='object_link'><a href="Persistence.html#persisted%3F-instance_method" title="Dynamoid::Persistence#persisted? (method)">#persisted?</a></span>, <span class='object_link'><a href="Persistence.html#save-instance_method" title="Dynamoid::Persistence#save (method)">#save</a></span></p>
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Indexes.html" title="Dynamoid::Indexes (module)">Indexes</a></span></h3>
306
+ <p class="inherited"><span class='object_link'><a href="Indexes.html#delete_indexes-instance_method" title="Dynamoid::Indexes#delete_indexes (method)">#delete_indexes</a></span>, <span class='object_link'><a href="Indexes.html#save_indexes-instance_method" title="Dynamoid::Indexes#save_indexes (method)">#save_indexes</a></span></p>
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Fields.html" title="Dynamoid::Fields (module)">Fields</a></span></h3>
317
+ <p class="inherited"><span class='object_link'><a href="Fields.html#read_attribute-instance_method" title="Dynamoid::Fields#read_attribute (method)">#read_attribute</a></span>, <span class='object_link'><a href="Fields.html#update_attribute-instance_method" title="Dynamoid::Fields#update_attribute (method)">#update_attribute</a></span>, <span class='object_link'><a href="Fields.html#update_attributes-instance_method" title="Dynamoid::Fields#update_attributes (method)">#update_attributes</a></span>, <span class='object_link'><a href="Fields.html#write_attribute-instance_method" title="Dynamoid::Fields#write_attribute (method)">#write_attribute</a></span></p>
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+ <div id="instance_method_details" class="method_details_list">
330
+ <h2>Instance Method Details</h2>
331
+
332
+
333
+ <div class="method_details first">
334
+ <p class="signature first" id="==-instance_method">
335
+
336
+ - (<tt>Object</tt>) <strong>==</strong>(other)
337
+
338
+
339
+
340
+ </p><div class="docstring">
341
+ <div class="discussion">
342
+ <p>An object is equal to another object if their ids are equal.</p>
343
+
344
+
345
+ </div>
346
+ </div>
347
+ <div class="tags">
348
+
349
+ <h3>Since:</h3>
350
+ <ul class="since">
351
+
352
+ <li>
353
+
354
+
355
+
356
+
357
+
358
+ <div class='inline'><p>0.2.0</p>
359
+ </div>
360
+
361
+ </li>
362
+
363
+ </ul>
364
+
365
+ </div><table class="source_code">
366
+ <tr>
367
+ <td>
368
+ <pre class="lines">
369
+
370
+
371
+ 118
372
+ 119
373
+ 120
374
+ 121</pre>
375
+ </td>
376
+ <td>
377
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 118</span>
378
+
379
+ <span class='kw'>def</span> <span class='op'>==</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
380
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
381
+ <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:hash_key</span><span class='rparen'>)</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span> <span class='op'>==</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span>
382
+ <span class='kw'>end</span></pre>
383
+ </td>
384
+ </tr>
385
+ </table>
386
+ </div>
387
+
388
+ <div class="method_details ">
389
+ <p class="signature " id="hash_key-instance_method">
390
+
391
+ - (<tt>Object</tt>) <strong>hash_key</strong>
392
+
393
+
394
+
395
+ </p><div class="docstring">
396
+ <div class="discussion">
397
+ <p>Return an object's hash key, regardless of what it might be called to the object.</p>
398
+
399
+
400
+ </div>
401
+ </div>
402
+ <div class="tags">
403
+
404
+ <h3>Since:</h3>
405
+ <ul class="since">
406
+
407
+ <li>
408
+
409
+
410
+
411
+
412
+
413
+ <div class='inline'><p>0.4.0</p>
414
+ </div>
415
+
416
+ </li>
417
+
418
+ </ul>
419
+
420
+ </div><table class="source_code">
421
+ <tr>
422
+ <td>
423
+ <pre class="lines">
424
+
425
+
426
+ 138
427
+ 139
428
+ 140</pre>
429
+ </td>
430
+ <td>
431
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 138</span>
432
+
433
+ <span class='kw'>def</span> <span class='id identifier rubyid_hash_key'>hash_key</span>
434
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><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_hash_key'>hash_key</span><span class='rparen'>)</span>
435
+ <span class='kw'>end</span></pre>
436
+ </td>
437
+ </tr>
438
+ </table>
439
+ </div>
440
+
441
+ <div class="method_details ">
442
+ <p class="signature " id="hash_key=-instance_method">
443
+
444
+ - (<tt>Object</tt>) <strong>hash_key=</strong>(key)
445
+
446
+
447
+
448
+ </p><div class="docstring">
449
+ <div class="discussion">
450
+ <p>Assign an object's hash key, regardless of what it might be called to the object.</p>
451
+
452
+
453
+ </div>
454
+ </div>
455
+ <div class="tags">
456
+
457
+ <h3>Since:</h3>
458
+ <ul class="since">
459
+
460
+ <li>
461
+
462
+
463
+
464
+
465
+
466
+ <div class='inline'><p>0.4.0</p>
467
+ </div>
468
+
469
+ </li>
470
+
471
+ </ul>
472
+
473
+ </div><table class="source_code">
474
+ <tr>
475
+ <td>
476
+ <pre class="lines">
477
+
478
+
479
+ 145
480
+ 146
481
+ 147</pre>
482
+ </td>
483
+ <td>
484
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 145</span>
485
+
486
+ <span class='kw'>def</span> <span class='id identifier rubyid_hash_key='>hash_key=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
487
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><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_hash_key'>hash_key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
488
+ <span class='kw'>end</span></pre>
489
+ </td>
490
+ </tr>
491
+ </table>
492
+ </div>
493
+
494
+ <div class="method_details ">
495
+ <p class="signature " id="initialize-instance_method">
496
+
497
+ - (<tt><span class='object_link'><a href="" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>initialize</strong>(attrs = {})
498
+
499
+
500
+
501
+ </p><div class="docstring">
502
+ <div class="discussion">
503
+ <p>Initialize a new object.</p>
504
+
505
+
506
+ </div>
507
+ </div>
508
+ <div class="tags">
509
+ <h3>Parameters:</h3>
510
+ <ul class="param">
511
+
512
+ <li>
513
+
514
+ <span class='name'>attrs</span>
515
+
516
+
517
+ <span class='type'>(<tt>Hash</tt>)</span>
518
+
519
+
520
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
521
+
522
+
523
+ &mdash;
524
+ <div class='inline'><p>Attributes with which to create the object.</p>
525
+ </div>
526
+
527
+ </li>
528
+
529
+ </ul>
530
+
531
+ <h3>Since:</h3>
532
+ <ul class="since">
533
+
534
+ <li>
535
+
536
+
537
+
538
+
539
+
540
+ <div class='inline'><p>0.2.0</p>
541
+ </div>
542
+
543
+ </li>
544
+
545
+ </ul>
546
+
547
+ </div><table class="source_code">
548
+ <tr>
549
+ <td>
550
+ <pre class="lines">
551
+
552
+
553
+ 105
554
+ 106
555
+ 107
556
+ 108
557
+ 109
558
+ 110
559
+ 111
560
+ 112
561
+ 113</pre>
562
+ </td>
563
+ <td>
564
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 105</span>
565
+
566
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_attrs'>attrs</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
567
+ <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_send'>send</span><span class='lparen'>(</span><span class='symbol'>:field</span><span class='comma'>,</span> <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_hash_key'>hash_key</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><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_hash_key'>hash_key</span><span class='rparen'>)</span>
568
+
569
+ <span class='ivar'>@new_record</span> <span class='op'>=</span> <span class='kw'>true</span>
570
+ <span class='ivar'>@attributes</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
571
+ <span class='ivar'>@associations</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
572
+
573
+ <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_undump'>undump</span><span class='lparen'>(</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span>
574
+ <span class='kw'>end</span></pre>
575
+ </td>
576
+ </tr>
577
+ </table>
578
+ </div>
579
+
580
+ <div class="method_details ">
581
+ <p class="signature " id="reload-instance_method">
582
+
583
+ - (<tt><span class='object_link'><a href="" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>reload</strong>
584
+
585
+
586
+
587
+ </p><div class="docstring">
588
+ <div class="discussion">
589
+ <p>Reload an object from the database -- if you suspect the object has changed in the datastore and you need those
590
+ changes to be reflected immediately, you would call this method.</p>
591
+
592
+
593
+ </div>
594
+ </div>
595
+ <div class="tags">
596
+
597
+ <h3>Returns:</h3>
598
+ <ul class="return">
599
+
600
+ <li>
601
+
602
+
603
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
604
+
605
+
606
+
607
+ &mdash;
608
+ <div class='inline'><p>the document this method was called on</p>
609
+ </div>
610
+
611
+ </li>
612
+
613
+ </ul>
614
+ <h3>Since:</h3>
615
+ <ul class="since">
616
+
617
+ <li>
618
+
619
+
620
+
621
+
622
+
623
+ <div class='inline'><p>0.2.0</p>
624
+ </div>
625
+
626
+ </li>
627
+
628
+ </ul>
629
+
630
+ </div><table class="source_code">
631
+ <tr>
632
+ <td>
633
+ <pre class="lines">
634
+
635
+
636
+ 129
637
+ 130
638
+ 131
639
+ 132
640
+ 133</pre>
641
+ </td>
642
+ <td>
643
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 129</span>
644
+
645
+ <span class='kw'>def</span> <span class='id identifier rubyid_reload'>reload</span>
646
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='op'>=</span> <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_find'>find</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span>
647
+ <span class='ivar'>@associations</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:reset</span><span class='rparen'>)</span>
648
+ <span class='kw'>self</span>
649
+ <span class='kw'>end</span></pre>
650
+ </td>
651
+ </tr>
652
+ </table>
653
+ </div>
654
+
655
+ </div>
656
+
657
+ </div>
658
+
659
+ <div id="footer">
660
+ Generated on Thu Apr 26 01:26:24 2012 by
661
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
662
+ 0.7.5 (ruby-1.9.3).
663
+ </div>
664
+
665
+ </body>
666
+ </html>