dynamoid 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. data/Dynamoid.gemspec +65 -3
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +6 -0
  4. data/README.markdown +117 -22
  5. data/Rakefile +22 -9
  6. data/VERSION +1 -1
  7. data/doc/.nojekyll +0 -0
  8. data/doc/Dynamoid.html +300 -0
  9. data/doc/Dynamoid/Adapter.html +1387 -0
  10. data/doc/Dynamoid/Adapter/AwsSdk.html +1561 -0
  11. data/doc/Dynamoid/Adapter/Local.html +1487 -0
  12. data/doc/Dynamoid/Associations.html +131 -0
  13. data/doc/Dynamoid/Associations/Association.html +1706 -0
  14. data/doc/Dynamoid/Associations/BelongsTo.html +339 -0
  15. data/doc/Dynamoid/Associations/ClassMethods.html +723 -0
  16. data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +339 -0
  17. data/doc/Dynamoid/Associations/HasMany.html +339 -0
  18. data/doc/Dynamoid/Associations/HasOne.html +339 -0
  19. data/doc/Dynamoid/Components.html +202 -0
  20. data/doc/Dynamoid/Config.html +395 -0
  21. data/doc/Dynamoid/Config/Options.html +609 -0
  22. data/doc/Dynamoid/Criteria.html +131 -0
  23. data/doc/Dynamoid/Criteria/Chain.html +759 -0
  24. data/doc/Dynamoid/Criteria/ClassMethods.html +98 -0
  25. data/doc/Dynamoid/Document.html +512 -0
  26. data/doc/Dynamoid/Document/ClassMethods.html +581 -0
  27. data/doc/Dynamoid/Errors.html +118 -0
  28. data/doc/Dynamoid/Errors/DocumentNotValid.html +210 -0
  29. data/doc/Dynamoid/Errors/Error.html +130 -0
  30. data/doc/Dynamoid/Errors/InvalidField.html +133 -0
  31. data/doc/Dynamoid/Errors/MissingRangeKey.html +133 -0
  32. data/doc/Dynamoid/Fields.html +649 -0
  33. data/doc/Dynamoid/Fields/ClassMethods.html +264 -0
  34. data/doc/Dynamoid/Finders.html +128 -0
  35. data/doc/Dynamoid/Finders/ClassMethods.html +502 -0
  36. data/doc/Dynamoid/Indexes.html +308 -0
  37. data/doc/Dynamoid/Indexes/ClassMethods.html +351 -0
  38. data/doc/Dynamoid/Indexes/Index.html +1089 -0
  39. data/doc/Dynamoid/Persistence.html +653 -0
  40. data/doc/Dynamoid/Persistence/ClassMethods.html +568 -0
  41. data/doc/Dynamoid/Validations.html +399 -0
  42. data/doc/_index.html +439 -0
  43. data/doc/class_list.html +47 -0
  44. data/doc/css/common.css +1 -0
  45. data/doc/css/full_list.css +55 -0
  46. data/doc/css/style.css +322 -0
  47. data/doc/file.LICENSE.html +66 -0
  48. data/doc/file.README.html +279 -0
  49. data/doc/file_list.html +52 -0
  50. data/doc/frames.html +13 -0
  51. data/doc/index.html +279 -0
  52. data/doc/js/app.js +205 -0
  53. data/doc/js/full_list.js +173 -0
  54. data/doc/js/jquery.js +16 -0
  55. data/doc/method_list.html +1054 -0
  56. data/doc/top-level-namespace.html +105 -0
  57. data/lib/dynamoid.rb +2 -1
  58. data/lib/dynamoid/adapter.rb +77 -6
  59. data/lib/dynamoid/adapter/aws_sdk.rb +96 -16
  60. data/lib/dynamoid/adapter/local.rb +84 -15
  61. data/lib/dynamoid/associations.rb +53 -4
  62. data/lib/dynamoid/associations/association.rb +154 -26
  63. data/lib/dynamoid/associations/belongs_to.rb +32 -6
  64. data/lib/dynamoid/associations/has_and_belongs_to_many.rb +29 -3
  65. data/lib/dynamoid/associations/has_many.rb +30 -4
  66. data/lib/dynamoid/associations/has_one.rb +26 -3
  67. data/lib/dynamoid/components.rb +7 -5
  68. data/lib/dynamoid/config.rb +15 -2
  69. data/lib/dynamoid/config/options.rb +8 -0
  70. data/lib/dynamoid/criteria.rb +7 -2
  71. data/lib/dynamoid/criteria/chain.rb +55 -8
  72. data/lib/dynamoid/document.rb +68 -7
  73. data/lib/dynamoid/errors.rb +17 -2
  74. data/lib/dynamoid/fields.rb +44 -1
  75. data/lib/dynamoid/finders.rb +32 -6
  76. data/lib/dynamoid/indexes.rb +22 -2
  77. data/lib/dynamoid/indexes/index.rb +48 -7
  78. data/lib/dynamoid/persistence.rb +111 -51
  79. data/lib/dynamoid/validations.rb +36 -0
  80. data/spec/app/models/address.rb +2 -1
  81. data/spec/app/models/camel_case.rb +11 -0
  82. data/spec/app/models/magazine.rb +4 -1
  83. data/spec/app/models/sponsor.rb +3 -1
  84. data/spec/app/models/subscription.rb +5 -1
  85. data/spec/app/models/user.rb +10 -1
  86. data/spec/dynamoid/associations/association_spec.rb +67 -1
  87. data/spec/dynamoid/associations/belongs_to_spec.rb +16 -1
  88. data/spec/dynamoid/associations/has_and_belongs_to_many_spec.rb +7 -0
  89. data/spec/dynamoid/associations/has_many_spec.rb +14 -0
  90. data/spec/dynamoid/associations/has_one_spec.rb +10 -1
  91. data/spec/dynamoid/criteria_spec.rb +5 -1
  92. data/spec/dynamoid/document_spec.rb +23 -3
  93. data/spec/dynamoid/fields_spec.rb +10 -1
  94. data/spec/dynamoid/indexes/index_spec.rb +19 -0
  95. data/spec/dynamoid/persistence_spec.rb +24 -0
  96. data/spec/dynamoid/validations_spec.rb +36 -0
  97. metadata +105 -4
@@ -0,0 +1,133 @@
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
+ Exception: Dynamoid::Errors::InvalidField
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 (I)</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="../Errors.html" title="Dynamoid::Errors (module)">Errors</a></span></span>
38
+ &raquo;
39
+ <span class="title">InvalidField</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>Exception: Dynamoid::Errors::InvalidField
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName"><span class='object_link'><a href="Error.html" title="Dynamoid::Errors::Error (class)">Error</a></span></span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">StandardError</li>
75
+
76
+ <li class="next"><span class='object_link'><a href="Error.html" title="Dynamoid::Errors::Error (class)">Error</a></span></li>
77
+
78
+ <li class="next">Dynamoid::Errors::InvalidField</li>
79
+
80
+ </ul>
81
+ <a href="#" class="inheritanceTree">show all</a>
82
+
83
+ </dd>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ <dt class="r2 last">Defined in:</dt>
94
+ <dd class="r2 last">lib/dynamoid/errors.rb</dd>
95
+
96
+ </dl>
97
+ <div class="clear"></div>
98
+
99
+ <h2>Overview</h2><div class="docstring">
100
+ <div class="discussion">
101
+ <p>InvalidField is raised when an attribute is specified for an index, but the attribute does not exist.</p>
102
+
103
+
104
+ </div>
105
+ </div>
106
+ <div class="tags">
107
+
108
+
109
+ </div>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ </div>
125
+
126
+ <div id="footer">
127
+ Generated on Tue Mar 27 17:53:05 2012 by
128
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
+ 0.7.5 (ruby-1.9.3).
130
+ </div>
131
+
132
+ </body>
133
+ </html>
@@ -0,0 +1,133 @@
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
+ Exception: Dynamoid::Errors::MissingRangeKey
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 (M)</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="../Errors.html" title="Dynamoid::Errors (module)">Errors</a></span></span>
38
+ &raquo;
39
+ <span class="title">MissingRangeKey</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>Exception: Dynamoid::Errors::MissingRangeKey
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName"><span class='object_link'><a href="Error.html" title="Dynamoid::Errors::Error (class)">Error</a></span></span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">StandardError</li>
75
+
76
+ <li class="next"><span class='object_link'><a href="Error.html" title="Dynamoid::Errors::Error (class)">Error</a></span></li>
77
+
78
+ <li class="next">Dynamoid::Errors::MissingRangeKey</li>
79
+
80
+ </ul>
81
+ <a href="#" class="inheritanceTree">show all</a>
82
+
83
+ </dd>
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+ <dt class="r2 last">Defined in:</dt>
94
+ <dd class="r2 last">lib/dynamoid/errors.rb</dd>
95
+
96
+ </dl>
97
+ <div class="clear"></div>
98
+
99
+ <h2>Overview</h2><div class="docstring">
100
+ <div class="discussion">
101
+ <p>MissingRangeKey is raised when a table that requires a range key is quieried without one.</p>
102
+
103
+
104
+ </div>
105
+ </div>
106
+ <div class="tags">
107
+
108
+
109
+ </div>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ </div>
125
+
126
+ <div id="footer">
127
+ Generated on Tue Mar 27 17:53:05 2012 by
128
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
129
+ 0.7.5 (ruby-1.9.3).
130
+ </div>
131
+
132
+ </body>
133
+ </html>
@@ -0,0 +1,649 @@
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::Fields
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 (F)</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">Fields</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::Fields
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+ <dt class="r1">Extended by:</dt>
70
+ <dd class="r1">ActiveSupport::Concern</dd>
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dt class="r2">Included in:</dt>
78
+ <dd class="r2"><span class='object_link'><a href="Components.html" title="Dynamoid::Components (module)">Components</a></span></dd>
79
+
80
+
81
+
82
+ <dt class="r1 last">Defined in:</dt>
83
+ <dd class="r1 last">lib/dynamoid/fields.rb</dd>
84
+
85
+ </dl>
86
+ <div class="clear"></div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+ <p>All fields on a Dynamoid::Document must be explicitly defined -- if you have fields in the database that are not
91
+ specified with field, then they will be ignored.</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="Fields/ClassMethods.html" title="Dynamoid::Fields::ClassMethods (module)">ClassMethods</a></span>
104
+
105
+
106
+
107
+
108
+ </p>
109
+
110
+
111
+
112
+
113
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
114
+ <ul class="summary">
115
+
116
+ <li class="public ">
117
+ <span class="summary_signature">
118
+
119
+ <a href="#attributes-instance_method" title="#attributes (instance method)">- (Object) <strong>attributes</strong> </a>
120
+
121
+
122
+
123
+ (also: #raw_attributes)
124
+
125
+ </span>
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+ <span class="summary_desc"><div class='inline'><p>You can access the attributes of an object directly on its attributes method, which is by default an empty hash.</p>
138
+ </div></span>
139
+
140
+ </li>
141
+
142
+
143
+ </ul>
144
+
145
+
146
+
147
+
148
+
149
+ <h2>
150
+ Instance Method Summary
151
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
152
+ </h2>
153
+
154
+ <ul class="summary">
155
+
156
+ <li class="public ">
157
+ <span class="summary_signature">
158
+
159
+ <a href="#read_attribute-instance_method" title="#read_attribute (instance method)">- (Object) <strong>read_attribute</strong>(name) </a>
160
+
161
+
162
+
163
+ (also: #[])
164
+
165
+ </span>
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <span class="summary_desc"><div class='inline'><p>Read an attribute from an object.</p>
175
+ </div></span>
176
+
177
+ </li>
178
+
179
+
180
+ <li class="public ">
181
+ <span class="summary_signature">
182
+
183
+ <a href="#update_attribute-instance_method" title="#update_attribute (instance method)">- (Object) <strong>update_attribute</strong>(attribute, value) </a>
184
+
185
+
186
+
187
+ </span>
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <span class="summary_desc"><div class='inline'><p>Update a single attribute, saving the object afterwards.</p>
197
+ </div></span>
198
+
199
+ </li>
200
+
201
+
202
+ <li class="public ">
203
+ <span class="summary_signature">
204
+
205
+ <a href="#update_attributes-instance_method" title="#update_attributes (instance method)">- (Object) <strong>update_attributes</strong>(attributes) </a>
206
+
207
+
208
+
209
+ </span>
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+ <span class="summary_desc"><div class='inline'><p>Updates multiple attibutes at once, saving the object once the updates are complete.</p>
219
+ </div></span>
220
+
221
+ </li>
222
+
223
+
224
+ <li class="public ">
225
+ <span class="summary_signature">
226
+
227
+ <a href="#write_attribute-instance_method" title="#write_attribute (instance method)">- (Object) <strong>write_attribute</strong>(name, value) </a>
228
+
229
+
230
+
231
+ (also: #[]=)
232
+
233
+ </span>
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+ <span class="summary_desc"><div class='inline'><p>Write an attribute on the object.</p>
243
+ </div></span>
244
+
245
+ </li>
246
+
247
+
248
+ </ul>
249
+
250
+
251
+
252
+
253
+ <div id="instance_attr_details" class="attr_details">
254
+ <h2>Instance Attribute Details</h2>
255
+
256
+
257
+ <span id="attributes=-instance_method"></span>
258
+ <span id="attributes-instance_method"></span>
259
+ <div class="method_details first">
260
+ <p class="signature first" id="attributes-instance_method">
261
+
262
+ - (<tt>Object</tt>) <strong>attributes</strong>
263
+
264
+
265
+
266
+ <span class="aliases">Also known as:
267
+ <span class="names"><span id='raw_attributes-instance_method'>raw_attributes</span></span>
268
+ </span>
269
+
270
+ </p><div class="docstring">
271
+ <div class="discussion">
272
+ <p>You can access the attributes of an object directly on its attributes method, which is by default an empty hash.</p>
273
+
274
+
275
+ </div>
276
+ </div>
277
+ <div class="tags">
278
+
279
+
280
+ </div><table class="source_code">
281
+ <tr>
282
+ <td>
283
+ <pre class="lines">
284
+
285
+
286
+ 45
287
+ 46
288
+ 47</pre>
289
+ </td>
290
+ <td>
291
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/fields.rb', line 45</span>
292
+
293
+ <span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
294
+ <span class='ivar'>@attributes</span>
295
+ <span class='kw'>end</span></pre>
296
+ </td>
297
+ </tr>
298
+ </table>
299
+ </div>
300
+
301
+ </div>
302
+
303
+
304
+ <div id="instance_method_details" class="method_details_list">
305
+ <h2>Instance Method Details</h2>
306
+
307
+
308
+ <div class="method_details first">
309
+ <p class="signature first" id="read_attribute-instance_method">
310
+
311
+ - (<tt>Object</tt>) <strong>read_attribute</strong>(name)
312
+
313
+
314
+
315
+ <span class="aliases">Also known as:
316
+ <span class="names"><span id='[]-instance_method'>[]</span></span>
317
+ </span>
318
+
319
+ </p><div class="docstring">
320
+ <div class="discussion">
321
+ <p>Read an attribute from an object.</p>
322
+
323
+
324
+ </div>
325
+ </div>
326
+ <div class="tags">
327
+ <h3>Parameters:</h3>
328
+ <ul class="param">
329
+
330
+ <li>
331
+
332
+ <span class='name'>name</span>
333
+
334
+
335
+ <span class='type'>(<tt>Symbol</tt>)</span>
336
+
337
+
338
+
339
+ &mdash;
340
+ <div class='inline'><p>the name of the field</p>
341
+ </div>
342
+
343
+ </li>
344
+
345
+ </ul>
346
+
347
+ <h3>Since:</h3>
348
+ <ul class="since">
349
+
350
+ <li>
351
+
352
+
353
+
354
+
355
+
356
+ <div class='inline'><p>0.2.0</p>
357
+ </div>
358
+
359
+ </li>
360
+
361
+ </ul>
362
+
363
+ </div><table class="source_code">
364
+ <tr>
365
+ <td>
366
+ <pre class="lines">
367
+
368
+
369
+ 64
370
+ 65
371
+ 66</pre>
372
+ </td>
373
+ <td>
374
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/fields.rb', line 64</span>
375
+
376
+ <span class='kw'>def</span> <span class='id identifier rubyid_read_attribute'>read_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
377
+ <span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span>
378
+ <span class='kw'>end</span></pre>
379
+ </td>
380
+ </tr>
381
+ </table>
382
+ </div>
383
+
384
+ <div class="method_details ">
385
+ <p class="signature " id="update_attribute-instance_method">
386
+
387
+ - (<tt>Object</tt>) <strong>update_attribute</strong>(attribute, value)
388
+
389
+
390
+
391
+ </p><div class="docstring">
392
+ <div class="discussion">
393
+ <p>Update a single attribute, saving the object afterwards.</p>
394
+
395
+
396
+ </div>
397
+ </div>
398
+ <div class="tags">
399
+ <h3>Parameters:</h3>
400
+ <ul class="param">
401
+
402
+ <li>
403
+
404
+ <span class='name'>attribute</span>
405
+
406
+
407
+ <span class='type'>(<tt>Symbol</tt>)</span>
408
+
409
+
410
+
411
+ &mdash;
412
+ <div class='inline'><p>the attribute to update</p>
413
+ </div>
414
+
415
+ </li>
416
+
417
+ <li>
418
+
419
+ <span class='name'>value</span>
420
+
421
+
422
+ <span class='type'>(<tt>Object</tt>)</span>
423
+
424
+
425
+
426
+ &mdash;
427
+ <div class='inline'><p>the value to assign it</p>
428
+ </div>
429
+
430
+ </li>
431
+
432
+ </ul>
433
+
434
+ <h3>Since:</h3>
435
+ <ul class="since">
436
+
437
+ <li>
438
+
439
+
440
+
441
+
442
+
443
+ <div class='inline'><p>0.2.0</p>
444
+ </div>
445
+
446
+ </li>
447
+
448
+ </ul>
449
+
450
+ </div><table class="source_code">
451
+ <tr>
452
+ <td>
453
+ <pre class="lines">
454
+
455
+
456
+ 85
457
+ 86
458
+ 87
459
+ 88</pre>
460
+ </td>
461
+ <td>
462
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/fields.rb', line 85</span>
463
+
464
+ <span class='kw'>def</span> <span class='id identifier rubyid_update_attribute'>update_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
465
+ <span class='id identifier rubyid_write_attribute'>write_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
466
+ <span class='id identifier rubyid_save'>save</span>
467
+ <span class='kw'>end</span></pre>
468
+ </td>
469
+ </tr>
470
+ </table>
471
+ </div>
472
+
473
+ <div class="method_details ">
474
+ <p class="signature " id="update_attributes-instance_method">
475
+
476
+ - (<tt>Object</tt>) <strong>update_attributes</strong>(attributes)
477
+
478
+
479
+
480
+ </p><div class="docstring">
481
+ <div class="discussion">
482
+ <p>Updates multiple attibutes at once, saving the object once the updates are complete.</p>
483
+
484
+
485
+ </div>
486
+ </div>
487
+ <div class="tags">
488
+ <h3>Parameters:</h3>
489
+ <ul class="param">
490
+
491
+ <li>
492
+
493
+ <span class='name'>attributes</span>
494
+
495
+
496
+ <span class='type'>(<tt>Hash</tt>)</span>
497
+
498
+
499
+
500
+ &mdash;
501
+ <div class='inline'><p>a hash of attributes to update</p>
502
+ </div>
503
+
504
+ </li>
505
+
506
+ </ul>
507
+
508
+ <h3>Since:</h3>
509
+ <ul class="since">
510
+
511
+ <li>
512
+
513
+
514
+
515
+
516
+
517
+ <div class='inline'><p>0.2.0</p>
518
+ </div>
519
+
520
+ </li>
521
+
522
+ </ul>
523
+
524
+ </div><table class="source_code">
525
+ <tr>
526
+ <td>
527
+ <pre class="lines">
528
+
529
+
530
+ 74
531
+ 75
532
+ 76
533
+ 77</pre>
534
+ </td>
535
+ <td>
536
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/fields.rb', line 74</span>
537
+
538
+ <span class='kw'>def</span> <span class='id identifier rubyid_update_attributes'>update_attributes</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span><span class='rparen'>)</span>
539
+ <span class='id identifier rubyid_attributes'>attributes</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='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_write_attribute'>write_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span><span class='rbrace'>}</span>
540
+ <span class='id identifier rubyid_save'>save</span>
541
+ <span class='kw'>end</span></pre>
542
+ </td>
543
+ </tr>
544
+ </table>
545
+ </div>
546
+
547
+ <div class="method_details ">
548
+ <p class="signature " id="write_attribute-instance_method">
549
+
550
+ - (<tt>Object</tt>) <strong>write_attribute</strong>(name, value)
551
+
552
+
553
+
554
+ <span class="aliases">Also known as:
555
+ <span class="names"><span id='[]=-instance_method'>[]=</span></span>
556
+ </span>
557
+
558
+ </p><div class="docstring">
559
+ <div class="discussion">
560
+ <p>Write an attribute on the object.</p>
561
+
562
+
563
+ </div>
564
+ </div>
565
+ <div class="tags">
566
+ <h3>Parameters:</h3>
567
+ <ul class="param">
568
+
569
+ <li>
570
+
571
+ <span class='name'>name</span>
572
+
573
+
574
+ <span class='type'>(<tt>Symbol</tt>)</span>
575
+
576
+
577
+
578
+ &mdash;
579
+ <div class='inline'><p>the name of the field</p>
580
+ </div>
581
+
582
+ </li>
583
+
584
+ <li>
585
+
586
+ <span class='name'>value</span>
587
+
588
+
589
+ <span class='type'>(<tt>Object</tt>)</span>
590
+
591
+
592
+
593
+ &mdash;
594
+ <div class='inline'><p>the value to assign to that field</p>
595
+ </div>
596
+
597
+ </li>
598
+
599
+ </ul>
600
+
601
+ <h3>Since:</h3>
602
+ <ul class="since">
603
+
604
+ <li>
605
+
606
+
607
+
608
+
609
+
610
+ <div class='inline'><p>0.2.0</p>
611
+ </div>
612
+
613
+ </li>
614
+
615
+ </ul>
616
+
617
+ </div><table class="source_code">
618
+ <tr>
619
+ <td>
620
+ <pre class="lines">
621
+
622
+
623
+ 54
624
+ 55
625
+ 56</pre>
626
+ </td>
627
+ <td>
628
+ <pre class="code"><span class="info file"># File 'lib/dynamoid/fields.rb', line 54</span>
629
+
630
+ <span class='kw'>def</span> <span class='id identifier rubyid_write_attribute'>write_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
631
+ <span class='id identifier rubyid_attributes'>attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
632
+ <span class='kw'>end</span></pre>
633
+ </td>
634
+ </tr>
635
+ </table>
636
+ </div>
637
+
638
+ </div>
639
+
640
+ </div>
641
+
642
+ <div id="footer">
643
+ Generated on Tue Mar 27 17:53:05 2012 by
644
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
645
+ 0.7.5 (ruby-1.9.3).
646
+ </div>
647
+
648
+ </body>
649
+ </html>