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,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
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '../..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="../../_index.html">Index (C)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span> » <span class='title'><span class='object_link'><a href="../Criteria.html" title="Dynamoid::Criteria (module)">Criteria</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">ClassMethods</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: Dynamoid::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 Tue Mar 27 17:53:06 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,512 @@
|
|
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
|
+
— 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> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../Dynamoid.html" title="Dynamoid (module)">Dynamoid</a></span></span>
|
38
|
+
»
|
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="#initialize-instance_method" title="#initialize (instance method)">- (Dynamoid::Document) <strong>initialize</strong>(attrs = {}) </a>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'><p>Initialize a new object.</p>
|
173
|
+
</div></span>
|
174
|
+
|
175
|
+
</li>
|
176
|
+
|
177
|
+
|
178
|
+
<li class="public ">
|
179
|
+
<span class="summary_signature">
|
180
|
+
|
181
|
+
<a href="#reload-instance_method" title="#reload (instance method)">- (Dynamoid::Document) <strong>reload</strong> </a>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
</span>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<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
|
195
|
+
changes to be reflected immediately, you would call this method.</p>
|
196
|
+
</div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
</ul>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Validations.html" title="Dynamoid::Validations (module)">Validations</a></span></h3>
|
220
|
+
<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>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Persistence.html" title="Dynamoid::Persistence (module)">Persistence</a></span></h3>
|
251
|
+
<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>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Indexes.html" title="Dynamoid::Indexes (module)">Indexes</a></span></h3>
|
262
|
+
<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>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Fields.html" title="Dynamoid::Fields (module)">Fields</a></span></h3>
|
273
|
+
<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>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<div id="instance_method_details" class="method_details_list">
|
284
|
+
<h2>Instance Method Details</h2>
|
285
|
+
|
286
|
+
|
287
|
+
<div class="method_details first">
|
288
|
+
<p class="signature first" id="==-instance_method">
|
289
|
+
|
290
|
+
- (<tt>Object</tt>) <strong>==</strong>(other)
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
</p><div class="docstring">
|
295
|
+
<div class="discussion">
|
296
|
+
<p>An object is equal to another object if their ids are equal.</p>
|
297
|
+
|
298
|
+
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
<div class="tags">
|
302
|
+
|
303
|
+
<h3>Since:</h3>
|
304
|
+
<ul class="since">
|
305
|
+
|
306
|
+
<li>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<div class='inline'><p>0.2.0</p>
|
313
|
+
</div>
|
314
|
+
|
315
|
+
</li>
|
316
|
+
|
317
|
+
</ul>
|
318
|
+
|
319
|
+
</div><table class="source_code">
|
320
|
+
<tr>
|
321
|
+
<td>
|
322
|
+
<pre class="lines">
|
323
|
+
|
324
|
+
|
325
|
+
89
|
326
|
+
90
|
327
|
+
91
|
328
|
+
92</pre>
|
329
|
+
</td>
|
330
|
+
<td>
|
331
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 89</span>
|
332
|
+
|
333
|
+
<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>
|
334
|
+
<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>
|
335
|
+
<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'>:id</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='op'>==</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span>
|
336
|
+
<span class='kw'>end</span></pre>
|
337
|
+
</td>
|
338
|
+
</tr>
|
339
|
+
</table>
|
340
|
+
</div>
|
341
|
+
|
342
|
+
<div class="method_details ">
|
343
|
+
<p class="signature " id="initialize-instance_method">
|
344
|
+
|
345
|
+
- (<tt><span class='object_link'><a href="" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>initialize</strong>(attrs = {})
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
</p><div class="docstring">
|
350
|
+
<div class="discussion">
|
351
|
+
<p>Initialize a new object.</p>
|
352
|
+
|
353
|
+
|
354
|
+
</div>
|
355
|
+
</div>
|
356
|
+
<div class="tags">
|
357
|
+
<h3>Parameters:</h3>
|
358
|
+
<ul class="param">
|
359
|
+
|
360
|
+
<li>
|
361
|
+
|
362
|
+
<span class='name'>attrs</span>
|
363
|
+
|
364
|
+
|
365
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
366
|
+
|
367
|
+
|
368
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
369
|
+
|
370
|
+
|
371
|
+
—
|
372
|
+
<div class='inline'><p>Attributes with which to create the object.</p>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
</li>
|
376
|
+
|
377
|
+
</ul>
|
378
|
+
|
379
|
+
<h3>Since:</h3>
|
380
|
+
<ul class="since">
|
381
|
+
|
382
|
+
<li>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
<div class='inline'><p>0.2.0</p>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
</li>
|
392
|
+
|
393
|
+
</ul>
|
394
|
+
|
395
|
+
</div><table class="source_code">
|
396
|
+
<tr>
|
397
|
+
<td>
|
398
|
+
<pre class="lines">
|
399
|
+
|
400
|
+
|
401
|
+
76
|
402
|
+
77
|
403
|
+
78
|
404
|
+
79
|
405
|
+
80
|
406
|
+
81
|
407
|
+
82
|
408
|
+
83
|
409
|
+
84</pre>
|
410
|
+
</td>
|
411
|
+
<td>
|
412
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 76</span>
|
413
|
+
|
414
|
+
<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>
|
415
|
+
<span class='ivar'>@new_record</span> <span class='op'>=</span> <span class='kw'>true</span>
|
416
|
+
<span class='ivar'>@attributes</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
417
|
+
<span class='id identifier rubyid_incoming_attributes'>incoming_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_undump'>undump</span><span class='lparen'>(</span><span class='id identifier rubyid_attrs'>attrs</span><span class='rparen'>)</span>
|
418
|
+
|
419
|
+
<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_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</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='op'>|</span>
|
420
|
+
<span class='id identifier rubyid_send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_incoming_attributes'>incoming_attributes</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span>
|
421
|
+
<span class='kw'>end</span>
|
422
|
+
<span class='kw'>end</span></pre>
|
423
|
+
</td>
|
424
|
+
</tr>
|
425
|
+
</table>
|
426
|
+
</div>
|
427
|
+
|
428
|
+
<div class="method_details ">
|
429
|
+
<p class="signature " id="reload-instance_method">
|
430
|
+
|
431
|
+
- (<tt><span class='object_link'><a href="" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>reload</strong>
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
</p><div class="docstring">
|
436
|
+
<div class="discussion">
|
437
|
+
<p>Reload an object from the database -- if you suspect the object has changed in the datastore and you need those
|
438
|
+
changes to be reflected immediately, you would call this method.</p>
|
439
|
+
|
440
|
+
|
441
|
+
</div>
|
442
|
+
</div>
|
443
|
+
<div class="tags">
|
444
|
+
|
445
|
+
<h3>Returns:</h3>
|
446
|
+
<ul class="return">
|
447
|
+
|
448
|
+
<li>
|
449
|
+
|
450
|
+
|
451
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
—
|
456
|
+
<div class='inline'><p>the document this method was called on</p>
|
457
|
+
</div>
|
458
|
+
|
459
|
+
</li>
|
460
|
+
|
461
|
+
</ul>
|
462
|
+
<h3>Since:</h3>
|
463
|
+
<ul class="since">
|
464
|
+
|
465
|
+
<li>
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
<div class='inline'><p>0.2.0</p>
|
472
|
+
</div>
|
473
|
+
|
474
|
+
</li>
|
475
|
+
|
476
|
+
</ul>
|
477
|
+
|
478
|
+
</div><table class="source_code">
|
479
|
+
<tr>
|
480
|
+
<td>
|
481
|
+
<pre class="lines">
|
482
|
+
|
483
|
+
|
484
|
+
100
|
485
|
+
101
|
486
|
+
102
|
487
|
+
103</pre>
|
488
|
+
</td>
|
489
|
+
<td>
|
490
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/document.rb', line 100</span>
|
491
|
+
|
492
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reload'>reload</span>
|
493
|
+
<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_id'>id</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_attributes'>attributes</span>
|
494
|
+
<span class='kw'>self</span>
|
495
|
+
<span class='kw'>end</span></pre>
|
496
|
+
</td>
|
497
|
+
</tr>
|
498
|
+
</table>
|
499
|
+
</div>
|
500
|
+
|
501
|
+
</div>
|
502
|
+
|
503
|
+
</div>
|
504
|
+
|
505
|
+
<div id="footer">
|
506
|
+
Generated on Tue Mar 27 17:53:06 2012 by
|
507
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
508
|
+
0.7.5 (ruby-1.9.3).
|
509
|
+
</div>
|
510
|
+
|
511
|
+
</body>
|
512
|
+
</html>
|