dynamoid 0.4.0 → 0.4.1
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.
- data/Dynamoid.gemspec +5 -3
- data/README.markdown +2 -2
- data/VERSION +1 -1
- data/doc/Dynamoid.html +26 -14
- data/doc/Dynamoid/Adapter.html +33 -35
- data/doc/Dynamoid/Adapter/AwsSdk.html +177 -153
- data/doc/Dynamoid/Adapter/Local.html +144 -57
- data/doc/Dynamoid/Associations.html +3 -3
- data/doc/Dynamoid/Associations/Association.html +104 -1016
- data/doc/Dynamoid/Associations/BelongsTo.html +11 -192
- data/doc/Dynamoid/Associations/ClassMethods.html +17 -17
- data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +15 -190
- data/doc/Dynamoid/Associations/HasMany.html +15 -190
- data/doc/Dynamoid/Associations/HasOne.html +11 -192
- data/doc/Dynamoid/Associations/ManyAssociation.html +1640 -0
- data/doc/Dynamoid/Associations/SingleAssociation.html +598 -0
- data/doc/Dynamoid/Components.html +4 -2
- data/doc/Dynamoid/Config.html +10 -10
- data/doc/Dynamoid/Config/Options.html +1 -1
- data/doc/Dynamoid/Criteria.html +1 -1
- data/doc/Dynamoid/Criteria/Chain.html +326 -22
- data/doc/Dynamoid/Criteria/ClassMethods.html +1 -1
- data/doc/Dynamoid/Document.html +181 -27
- data/doc/Dynamoid/Document/ClassMethods.html +392 -36
- data/doc/Dynamoid/Errors.html +1 -1
- data/doc/Dynamoid/Errors/DocumentNotValid.html +1 -1
- data/doc/Dynamoid/Errors/Error.html +1 -1
- data/doc/Dynamoid/Errors/InvalidField.html +1 -1
- data/doc/Dynamoid/Errors/MissingRangeKey.html +1 -1
- data/doc/Dynamoid/Fields.html +44 -24
- data/doc/Dynamoid/Fields/ClassMethods.html +60 -15
- data/doc/Dynamoid/Finders.html +1 -1
- data/doc/Dynamoid/Finders/ClassMethods.html +45 -31
- data/doc/Dynamoid/Indexes.html +7 -7
- data/doc/Dynamoid/Indexes/ClassMethods.html +6 -4
- data/doc/Dynamoid/Indexes/Index.html +47 -32
- data/doc/Dynamoid/Persistence.html +47 -49
- data/doc/Dynamoid/Persistence/ClassMethods.html +149 -47
- data/doc/Dynamoid/Validations.html +1 -1
- data/doc/_index.html +35 -13
- data/doc/class_list.html +1 -1
- data/doc/file.LICENSE.html +1 -1
- data/doc/file.README.html +37 -4
- data/doc/index.html +37 -4
- data/doc/method_list.html +320 -136
- data/doc/top-level-namespace.html +1 -1
- data/lib/dynamoid/adapter.rb +28 -30
- data/lib/dynamoid/adapter/aws_sdk.rb +23 -22
- data/lib/dynamoid/persistence.rb +33 -27
- metadata +6 -4
@@ -180,7 +180,7 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
180
180
|
<li class="public ">
|
181
181
|
<span class="summary_signature">
|
182
182
|
|
183
|
-
<a href="#delete_item-instance_method" title="#delete_item (instance method)">- (Object) <strong>delete_item</strong>(table_name, key,
|
183
|
+
<a href="#delete_item-instance_method" title="#delete_item (instance method)">- (Object) <strong>delete_item</strong>(table_name, key, options = {}) </a>
|
184
184
|
|
185
185
|
|
186
186
|
|
@@ -224,7 +224,28 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
224
224
|
<li class="public ">
|
225
225
|
<span class="summary_signature">
|
226
226
|
|
227
|
-
<a href="#
|
227
|
+
<a href="#drop_till_start-instance_method" title="#drop_till_start (instance method)">- (Object) <strong>drop_till_start</strong>(results, next_token, range_key, hash_key) </a>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</span>
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
<li class="public ">
|
246
|
+
<span class="summary_signature">
|
247
|
+
|
248
|
+
<a href="#get_item-instance_method" title="#get_item (instance method)">- (Hash) <strong>get_item</strong>(table_name, key, options = {}) </a>
|
228
249
|
|
229
250
|
|
230
251
|
|
@@ -334,7 +355,7 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
334
355
|
<li class="public ">
|
335
356
|
<span class="summary_signature">
|
336
357
|
|
337
|
-
<a href="#scan-instance_method" title="#scan (instance method)">- (Array) <strong>scan</strong>(table_name, scan_hash) </a>
|
358
|
+
<a href="#scan-instance_method" title="#scan (instance method)">- (Array) <strong>scan</strong>(table_name, scan_hash, opts = {}) </a>
|
338
359
|
|
339
360
|
|
340
361
|
|
@@ -471,7 +492,7 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
471
492
|
<span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span>
|
472
493
|
<span class='kw'>if</span> <span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span>
|
473
494
|
<span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_keys'>keys</span><span class='rparen'>)</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_hash_key'>hash_key</span><span class='comma'>,</span> <span class='id identifier rubyid_range_key'>range_key</span><span class='op'>|</span>
|
474
|
-
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_get_item'>get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span> <span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span>
|
495
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span> <span class='op'><<</span> <span class='id identifier rubyid_get_item'>get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_hash_key'>hash_key</span><span class='comma'>,</span> <span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_range_key'>range_key</span><span class='rparen'>)</span>
|
475
496
|
<span class='kw'>end</span>
|
476
497
|
<span class='kw'>else</span>
|
477
498
|
<span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_keys'>keys</span><span class='rparen'>)</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_key'>key</span><span class='op'>|</span>
|
@@ -577,13 +598,15 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
577
598
|
|
578
599
|
59
|
579
600
|
60
|
580
|
-
61
|
601
|
+
61
|
602
|
+
62</pre>
|
581
603
|
</td>
|
582
604
|
<td>
|
583
605
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 59</span>
|
584
606
|
|
585
607
|
<span class='kw'>def</span> <span class='id identifier rubyid_create_table'>create_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
586
|
-
<span class='id identifier
|
608
|
+
<span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
609
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:hash_key</span> <span class='op'>=></span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='symbol'>:range_key</span> <span class='op'>=></span> <span class='id identifier rubyid_range_key'>range_key</span><span class='comma'>,</span> <span class='symbol'>:data</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rbrace'>}</span>
|
587
610
|
<span class='kw'>end</span></pre>
|
588
611
|
</td>
|
589
612
|
</tr>
|
@@ -663,7 +686,7 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
663
686
|
<div class="method_details ">
|
664
687
|
<p class="signature " id="delete_item-instance_method">
|
665
688
|
|
666
|
-
- (<tt>Object</tt>) <strong>delete_item</strong>(table_name, key,
|
689
|
+
- (<tt>Object</tt>) <strong>delete_item</strong>(table_name, key, options = {})
|
667
690
|
|
668
691
|
|
669
692
|
|
@@ -716,8 +739,6 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
716
739
|
<span class='type'>(<tt>Number</tt>)</span>
|
717
740
|
|
718
741
|
|
719
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
720
|
-
|
721
742
|
|
722
743
|
—
|
723
744
|
<div class='inline'><p>the range key of the item to delete, required if the table has a composite key</p>
|
@@ -749,14 +770,16 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
749
770
|
<pre class="lines">
|
750
771
|
|
751
772
|
|
752
|
-
70
|
753
773
|
71
|
754
|
-
72
|
774
|
+
72
|
775
|
+
73
|
776
|
+
74</pre>
|
755
777
|
</td>
|
756
778
|
<td>
|
757
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
779
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 71</span>
|
758
780
|
|
759
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_delete_item'>delete_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier
|
781
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_delete_item'>delete_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
782
|
+
<span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='symbol'>:range_key</span><span class='rparen'>)</span>
|
760
783
|
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</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='embexpr_beg'>#{</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
761
784
|
<span class='kw'>end</span></pre>
|
762
785
|
</td>
|
@@ -821,12 +844,12 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
821
844
|
<pre class="lines">
|
822
845
|
|
823
846
|
|
824
|
-
|
825
|
-
|
826
|
-
|
847
|
+
81
|
848
|
+
82
|
849
|
+
83</pre>
|
827
850
|
</td>
|
828
851
|
<td>
|
829
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
852
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 81</span>
|
830
853
|
|
831
854
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete_table'>delete_table</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
832
855
|
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rparen'>)</span>
|
@@ -834,12 +857,54 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
834
857
|
</td>
|
835
858
|
</tr>
|
836
859
|
</table>
|
860
|
+
</div>
|
861
|
+
|
862
|
+
<div class="method_details ">
|
863
|
+
<p class="signature " id="drop_till_start-instance_method">
|
864
|
+
|
865
|
+
- (<tt>Object</tt>) <strong>drop_till_start</strong>(results, next_token, range_key, hash_key)
|
866
|
+
|
867
|
+
|
868
|
+
|
869
|
+
</p><table class="source_code">
|
870
|
+
<tr>
|
871
|
+
<td>
|
872
|
+
<pre class="lines">
|
873
|
+
|
874
|
+
|
875
|
+
180
|
876
|
+
181
|
877
|
+
182
|
878
|
+
183
|
879
|
+
184
|
880
|
+
185
|
881
|
+
186
|
882
|
+
187
|
883
|
+
188
|
884
|
+
189</pre>
|
885
|
+
</td>
|
886
|
+
<td>
|
887
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 180</span>
|
888
|
+
|
889
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_drop_till_start'>drop_till_start</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='comma'>,</span> <span class='id identifier rubyid_next_token'>next_token</span><span class='comma'>,</span> <span class='id identifier rubyid_range_key'>range_key</span><span class='comma'>,</span> <span class='id identifier rubyid_hash_key'>hash_key</span><span class='rparen'>)</span>
|
890
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_results'>results</span> <span class='kw'>unless</span> <span class='id identifier rubyid_next_token'>next_token</span>
|
891
|
+
|
892
|
+
<span class='id identifier rubyid_hash_value'>hash_value</span> <span class='op'>=</span> <span class='id identifier rubyid_next_token'>next_token</span><span class='lbracket'>[</span><span class='symbol'>:hash_key_element</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
|
893
|
+
<span class='id identifier rubyid_range_value'>range_value</span> <span class='op'>=</span> <span class='id identifier rubyid_next_token'>next_token</span><span class='lbracket'>[</span><span class='symbol'>:range_key_element</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='kw'>if</span> <span class='id identifier rubyid_next_token'>next_token</span><span class='lbracket'>[</span><span class='symbol'>:range_key_element</span><span class='rbracket'>]</span>
|
894
|
+
|
895
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_drop_while'>drop_while</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='op'>|</span>
|
896
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_r'>r</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='id identifier rubyid_hash_value'>hash_value</span> <span class='kw'>or</span> <span class='id identifier rubyid_r'>r</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span> <span class='op'>!=</span> <span class='id identifier rubyid_range_value'>range_value</span><span class='rparen'>)</span>
|
897
|
+
<span class='kw'>end</span><span class='period'>.</span><span class='id identifier rubyid_drop'>drop</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
|
898
|
+
<span class='kw'>end</span></pre>
|
899
|
+
</td>
|
900
|
+
</tr>
|
901
|
+
</table>
|
837
902
|
</div>
|
838
903
|
|
839
904
|
<div class="method_details ">
|
840
905
|
<p class="signature " id="get_item-instance_method">
|
841
906
|
|
842
|
-
- (<tt>Hash</tt>) <strong>get_item</strong>(table_name, key,
|
907
|
+
- (<tt>Hash</tt>) <strong>get_item</strong>(table_name, key, options = {})
|
843
908
|
|
844
909
|
|
845
910
|
|
@@ -892,8 +957,6 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
892
957
|
<span class='type'>(<tt>Number</tt>)</span>
|
893
958
|
|
894
959
|
|
895
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
896
|
-
|
897
960
|
|
898
961
|
—
|
899
962
|
<div class='inline'><p>the range key of the item to find, required if the table has a composite key</p>
|
@@ -942,18 +1005,20 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
942
1005
|
<pre class="lines">
|
943
1006
|
|
944
1007
|
|
945
|
-
94
|
946
|
-
95
|
947
1008
|
96
|
948
1009
|
97
|
949
1010
|
98
|
950
1011
|
99
|
951
|
-
100
|
1012
|
+
100
|
1013
|
+
101
|
1014
|
+
102
|
1015
|
+
103</pre>
|
952
1016
|
</td>
|
953
1017
|
<td>
|
954
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
1018
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 96</span>
|
955
1019
|
|
956
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_get_item'>get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier
|
1020
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get_item'>get_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1021
|
+
<span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span>
|
957
1022
|
<span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span>
|
958
1023
|
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</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='embexpr_beg'>#{</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
959
1024
|
<span class='kw'>else</span>
|
@@ -1003,12 +1068,12 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1003
1068
|
<pre class="lines">
|
1004
1069
|
|
1005
1070
|
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1071
|
+
108
|
1072
|
+
109
|
1073
|
+
110</pre>
|
1009
1074
|
</td>
|
1010
1075
|
<td>
|
1011
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
1076
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 108</span>
|
1012
1077
|
|
1013
1078
|
<span class='kw'>def</span> <span class='id identifier rubyid_list_tables'>list_tables</span>
|
1014
1079
|
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
@@ -1090,19 +1155,23 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1090
1155
|
<pre class="lines">
|
1091
1156
|
|
1092
1157
|
|
1093
|
-
115
|
1094
|
-
116
|
1095
|
-
117
|
1096
1158
|
118
|
1097
|
-
119
|
1159
|
+
119
|
1160
|
+
120
|
1161
|
+
121
|
1162
|
+
122
|
1163
|
+
123
|
1164
|
+
124</pre>
|
1098
1165
|
</td>
|
1099
1166
|
<td>
|
1100
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
1167
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 118</span>
|
1101
1168
|
|
1102
1169
|
<span class='kw'>def</span> <span class='id identifier rubyid_put_item'>put_item</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
|
1103
1170
|
<span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span>
|
1104
1171
|
<span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_object'>object</span><span class='lbracket'>[</span><span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='symbol'>:hash_key</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1105
1172
|
<span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='lbracket'>[</span><span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='symbol'>:hash_key</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_object'>object</span><span class='lbracket'>[</span><span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</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_v'>v</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'>&&</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1173
|
+
<span class='kw'>rescue</span>
|
1174
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span>
|
1106
1175
|
<span class='kw'>end</span></pre>
|
1107
1176
|
</td>
|
1108
1177
|
</tr>
|
@@ -1271,11 +1340,6 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1271
1340
|
<pre class="lines">
|
1272
1341
|
|
1273
1342
|
|
1274
|
-
135
|
1275
|
-
136
|
1276
|
-
137
|
1277
|
-
138
|
1278
|
-
139
|
1279
1343
|
140
|
1280
1344
|
141
|
1281
1345
|
142
|
@@ -1287,27 +1351,44 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1287
1351
|
148
|
1288
1352
|
149
|
1289
1353
|
150
|
1290
|
-
151
|
1354
|
+
151
|
1355
|
+
152
|
1356
|
+
153
|
1357
|
+
154
|
1358
|
+
155
|
1359
|
+
156
|
1360
|
+
157
|
1361
|
+
158
|
1362
|
+
159
|
1363
|
+
160
|
1364
|
+
161
|
1365
|
+
162</pre>
|
1291
1366
|
</td>
|
1292
1367
|
<td>
|
1293
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
1368
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 140</span>
|
1294
1369
|
|
1295
1370
|
<span class='kw'>def</span> <span class='id identifier rubyid_query'>query</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1296
1371
|
<span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:hash_value</span><span class='rbracket'>]</span>
|
1372
|
+
<span class='id identifier rubyid_hash_key'>hash_key</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:hash_key</span><span class='rbracket'>]</span>
|
1297
1373
|
<span class='id identifier rubyid_range_key'>range_key</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span>
|
1298
|
-
|
1299
|
-
|
1374
|
+
|
1375
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_value</span><span class='rbracket'>]</span>
|
1376
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_value</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1300
1377
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_greater_than</span><span class='rbracket'>]</span>
|
1301
|
-
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='
|
1378
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span> <span class='op'>></span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_greater_than</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1302
1379
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_less_than</span><span class='rbracket'>]</span>
|
1303
|
-
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='
|
1380
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span> <span class='op'><</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_less_than</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1304
1381
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_gte</span><span class='rbracket'>]</span>
|
1305
|
-
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='
|
1382
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span> <span class='op'>>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_gte</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1306
1383
|
<span class='kw'>elsif</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_lte</span><span class='rbracket'>]</span>
|
1307
|
-
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='
|
1384
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_id'>id</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_range_key'>range_key</span><span class='rbracket'>]</span> <span class='op'><=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:range_lte</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1308
1385
|
<span class='kw'>else</span>
|
1309
|
-
<span class='id identifier
|
1386
|
+
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_find_all'>find_all</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_v'>v</span><span class='lbracket'>[</span><span class='id identifier rubyid_hash_key'>hash_key</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_id'>id</span><span class='rbrace'>}</span>
|
1310
1387
|
<span class='kw'>end</span>
|
1388
|
+
|
1389
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_drop_till_start'>drop_till_start</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:next_token</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_range_key'>range_key</span><span class='comma'>,</span> <span class='id identifier rubyid_hash_key'>hash_key</span><span class='rparen'>)</span>
|
1390
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_take'>take</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:limit</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:limit</span><span class='rbracket'>]</span>
|
1391
|
+
<span class='id identifier rubyid_results'>results</span>
|
1311
1392
|
<span class='kw'>end</span></pre>
|
1312
1393
|
</td>
|
1313
1394
|
</tr>
|
@@ -1370,7 +1451,7 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1370
1451
|
<div class="method_details ">
|
1371
1452
|
<p class="signature " id="scan-instance_method">
|
1372
1453
|
|
1373
|
-
- (<tt>Array</tt>) <strong>scan</strong>(table_name, scan_hash)
|
1454
|
+
- (<tt>Array</tt>) <strong>scan</strong>(table_name, scan_hash, opts = {})
|
1374
1455
|
|
1375
1456
|
|
1376
1457
|
|
@@ -1456,17 +1537,23 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1456
1537
|
<pre class="lines">
|
1457
1538
|
|
1458
1539
|
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1540
|
+
172
|
1541
|
+
173
|
1542
|
+
174
|
1543
|
+
175
|
1544
|
+
176
|
1545
|
+
177
|
1546
|
+
178</pre>
|
1463
1547
|
</td>
|
1464
1548
|
<td>
|
1465
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line
|
1549
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/adapter/local.rb', line 172</span>
|
1466
1550
|
|
1467
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_scan_hash'>scan_hash</span><span class='rparen'>)</span>
|
1551
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='id identifier rubyid_table_name'>table_name</span><span class='comma'>,</span> <span class='id identifier rubyid_scan_hash'>scan_hash</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1468
1552
|
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1469
|
-
<span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span> <span class='id identifier rubyid_scan_hash'>scan_hash</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>!</span><span class='id identifier rubyid_d'>d</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_d'>d</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span><span class='rbrace'>}</span>
|
1553
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:data</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_d'>d</span><span class='op'>|</span> <span class='id identifier rubyid_scan_hash'>scan_hash</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='op'>!</span><span class='id identifier rubyid_d'>d</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='id identifier rubyid_d'>d</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span><span class='rbrace'>}</span>
|
1554
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_drop_till_start'>drop_till_start</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:next_token</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:range_key</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_table_name'>table_name</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:hash_key</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1555
|
+
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_take'>take</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:limit</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:limit</span><span class='rbracket'>]</span>
|
1556
|
+
<span class='id identifier rubyid_results'>results</span>
|
1470
1557
|
<span class='kw'>end</span></pre>
|
1471
1558
|
</td>
|
1472
1559
|
</tr>
|
@@ -1478,7 +1565,7 @@ All tests pass with either this or connecting to the real DynamoDB, and that's g
|
|
1478
1565
|
</div>
|
1479
1566
|
|
1480
1567
|
<div id="footer">
|
1481
|
-
Generated on
|
1568
|
+
Generated on Thu Apr 26 01:26:25 2012 by
|
1482
1569
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1483
1570
|
0.7.5 (ruby-1.9.3).
|
1484
1571
|
</div>
|
@@ -81,7 +81,7 @@
|
|
81
81
|
|
82
82
|
<dt class="r1 last">Defined in:</dt>
|
83
83
|
<dd class="r1 last">lib/dynamoid/associations.rb<span class="defines">,<br />
|
84
|
-
lib/dynamoid/associations/has_one.rb,<br /> lib/dynamoid/associations/has_many.rb,<br /> lib/dynamoid/associations/belongs_to.rb,<br /> lib/dynamoid/associations/association.rb,<br /> lib/dynamoid/associations/has_and_belongs_to_many.rb</span>
|
84
|
+
lib/dynamoid/associations/has_one.rb,<br /> lib/dynamoid/associations/has_many.rb,<br /> lib/dynamoid/associations/belongs_to.rb,<br /> lib/dynamoid/associations/association.rb,<br /> lib/dynamoid/associations/many_association.rb,<br /> lib/dynamoid/associations/single_association.rb,<br /> lib/dynamoid/associations/has_and_belongs_to_many.rb</span>
|
85
85
|
</dd>
|
86
86
|
|
87
87
|
</dl>
|
@@ -101,7 +101,7 @@
|
|
101
101
|
<p class="children">
|
102
102
|
|
103
103
|
|
104
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Associations/Association.html" title="Dynamoid::Associations::Association (module)">Association</a></span>, <span class='object_link'><a href="Associations/ClassMethods.html" title="Dynamoid::Associations::ClassMethods (module)">ClassMethods</a></span>
|
104
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Associations/Association.html" title="Dynamoid::Associations::Association (module)">Association</a></span>, <span class='object_link'><a href="Associations/ClassMethods.html" title="Dynamoid::Associations::ClassMethods (module)">ClassMethods</a></span>, <span class='object_link'><a href="Associations/ManyAssociation.html" title="Dynamoid::Associations::ManyAssociation (module)">ManyAssociation</a></span>, <span class='object_link'><a href="Associations/SingleAssociation.html" title="Dynamoid::Associations::SingleAssociation (module)">SingleAssociation</a></span>
|
105
105
|
|
106
106
|
|
107
107
|
|
@@ -122,7 +122,7 @@
|
|
122
122
|
</div>
|
123
123
|
|
124
124
|
<div id="footer">
|
125
|
-
Generated on
|
125
|
+
Generated on Thu Apr 26 01:26:25 2012 by
|
126
126
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
127
127
|
0.7.5 (ruby-1.9.3).
|
128
128
|
</div>
|
@@ -68,19 +68,15 @@
|
|
68
68
|
|
69
69
|
|
70
70
|
|
71
|
-
<dt class="r1">Includes:</dt>
|
72
|
-
<dd class="r1">Enumerable</dd>
|
73
|
-
|
74
|
-
|
75
71
|
|
76
72
|
|
77
|
-
<dt class="
|
78
|
-
<dd class="
|
73
|
+
<dt class="r1">Included in:</dt>
|
74
|
+
<dd class="r1"><span class='object_link'><a href="HasOne.html" title="Dynamoid::Associations::HasOne (class)">HasOne</a></span>, <span class='object_link'><a href="ManyAssociation.html" title="Dynamoid::Associations::ManyAssociation (module)">ManyAssociation</a></span>, <span class='object_link'><a href="SingleAssociation.html" title="Dynamoid::Associations::SingleAssociation (module)">SingleAssociation</a></span></dd>
|
79
75
|
|
80
76
|
|
81
77
|
|
82
|
-
<dt class="
|
83
|
-
<dd class="
|
78
|
+
<dt class="r2 last">Defined in:</dt>
|
79
|
+
<dd class="r2 last">lib/dynamoid/associations/association.rb</dd>
|
84
80
|
|
85
81
|
</dl>
|
86
82
|
<div class="clear"></div>
|
@@ -95,7 +91,7 @@
|
|
95
91
|
<li class="public ">
|
96
92
|
<span class="summary_signature">
|
97
93
|
|
98
|
-
<a href="#
|
94
|
+
<a href="#loaded-instance_method" title="#loaded (instance method)">- (Object) <strong>loaded</strong> </a>
|
99
95
|
|
100
96
|
|
101
97
|
|
@@ -111,7 +107,7 @@
|
|
111
107
|
|
112
108
|
|
113
109
|
|
114
|
-
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute
|
110
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute loaded.</p>
|
115
111
|
</div></span>
|
116
112
|
|
117
113
|
</li>
|
@@ -120,7 +116,7 @@
|
|
120
116
|
<li class="public ">
|
121
117
|
<span class="summary_signature">
|
122
118
|
|
123
|
-
<a href="#
|
119
|
+
<a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
|
124
120
|
|
125
121
|
|
126
122
|
|
@@ -136,7 +132,7 @@
|
|
136
132
|
|
137
133
|
|
138
134
|
|
139
|
-
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute
|
135
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute name.</p>
|
140
136
|
</div></span>
|
141
137
|
|
142
138
|
</li>
|
@@ -145,7 +141,7 @@
|
|
145
141
|
<li class="public ">
|
146
142
|
<span class="summary_signature">
|
147
143
|
|
148
|
-
<a href="#
|
144
|
+
<a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
|
149
145
|
|
150
146
|
|
151
147
|
|
@@ -161,7 +157,7 @@
|
|
161
157
|
|
162
158
|
|
163
159
|
|
164
|
-
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute
|
160
|
+
<span class="summary_desc"><div class='inline'><p>Returns the value of attribute options.</p>
|
165
161
|
</div></span>
|
166
162
|
|
167
163
|
</li>
|
@@ -208,161 +204,7 @@
|
|
208
204
|
<li class="public ">
|
209
205
|
<span class="summary_signature">
|
210
206
|
|
211
|
-
<a href="
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
</span>
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
<span class="summary_desc"><div class='inline'><p>Add an object or array of objects to an association.</p>
|
225
|
-
</div></span>
|
226
|
-
|
227
|
-
</li>
|
228
|
-
|
229
|
-
|
230
|
-
<li class="public ">
|
231
|
-
<span class="summary_signature">
|
232
|
-
|
233
|
-
<a href="#create-instance_method" title="#create (instance method)">- (Dynamoid::Document) <strong>create</strong>(attributes = {}) </a>
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
</span>
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
<span class="summary_desc"><div class='inline'><p>Create a new instance of the target class and add it directly to the association.</p>
|
247
|
-
</div></span>
|
248
|
-
|
249
|
-
</li>
|
250
|
-
|
251
|
-
|
252
|
-
<li class="public ">
|
253
|
-
<span class="summary_signature">
|
254
|
-
|
255
|
-
<a href="#create%21-instance_method" title="#create! (instance method)">- (Dynamoid::Document) <strong>create!</strong>(attributes = {}) </a>
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
</span>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
<span class="summary_desc"><div class='inline'><p>Create a new instance of the target class and add it directly to the association.</p>
|
269
|
-
</div></span>
|
270
|
-
|
271
|
-
</li>
|
272
|
-
|
273
|
-
|
274
|
-
<li class="public ">
|
275
|
-
<span class="summary_signature">
|
276
|
-
|
277
|
-
<a href="#delete-instance_method" title="#delete (instance method)">- (Dynamoid::Document) <strong>delete</strong>(object) </a>
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
</span>
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
<span class="summary_desc"><div class='inline'><p>Deletes an object or array of objects from the association.</p>
|
291
|
-
</div></span>
|
292
|
-
|
293
|
-
</li>
|
294
|
-
|
295
|
-
|
296
|
-
<li class="public ">
|
297
|
-
<span class="summary_signature">
|
298
|
-
|
299
|
-
<a href="#delete_all-instance_method" title="#delete_all (instance method)">- (Object) <strong>delete_all</strong> </a>
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
</span>
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
<span class="summary_desc"><div class='inline'><p>Deletes all members of the association and removes them from the association.</p>
|
313
|
-
</div></span>
|
314
|
-
|
315
|
-
</li>
|
316
|
-
|
317
|
-
|
318
|
-
<li class="public ">
|
319
|
-
<span class="summary_signature">
|
320
|
-
|
321
|
-
<a href="#destroy_all-instance_method" title="#destroy_all (instance method)">- (Object) <strong>destroy_all</strong> </a>
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
</span>
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
<span class="summary_desc"><div class='inline'><p>Destroys all members of the association and removes them from the association.</p>
|
335
|
-
</div></span>
|
336
|
-
|
337
|
-
</li>
|
338
|
-
|
339
|
-
|
340
|
-
<li class="public ">
|
341
|
-
<span class="summary_signature">
|
342
|
-
|
343
|
-
<a href="#each-instance_method" title="#each (instance method)">- (Dynamoid::Document) <strong>each</strong>(&block) </a>
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
</span>
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
<span class="summary_desc"><div class='inline'><p>Create a new instance of the target class and add it directly to the association.</p>
|
357
|
-
</div></span>
|
358
|
-
|
359
|
-
</li>
|
360
|
-
|
361
|
-
|
362
|
-
<li class="public ">
|
363
|
-
<span class="summary_signature">
|
364
|
-
|
365
|
-
<a href="#include%3F-instance_method" title="#include? (instance method)">- (Boolean) <strong>include?</strong>(object) </a>
|
207
|
+
<a href="#find_target-instance_method" title="#find_target (instance method)">- (Object) <strong>find_target</strong> </a>
|
366
208
|
|
367
209
|
|
368
210
|
|
@@ -375,8 +217,7 @@
|
|
375
217
|
|
376
218
|
|
377
219
|
|
378
|
-
<span class="summary_desc"><div class='inline'
|
379
|
-
</div></span>
|
220
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
380
221
|
|
381
222
|
</li>
|
382
223
|
|
@@ -406,12 +247,10 @@
|
|
406
247
|
<li class="public ">
|
407
248
|
<span class="summary_signature">
|
408
249
|
|
409
|
-
<a href="#
|
250
|
+
<a href="#loaded%3F-instance_method" title="#loaded? (instance method)">- (Boolean) <strong>loaded?</strong> </a>
|
410
251
|
|
411
252
|
|
412
253
|
|
413
|
-
(also: #all)
|
414
|
-
|
415
254
|
</span>
|
416
255
|
|
417
256
|
|
@@ -421,8 +260,7 @@
|
|
421
260
|
|
422
261
|
|
423
262
|
|
424
|
-
<span class="summary_desc"><div class='inline'
|
425
|
-
</div></span>
|
263
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
426
264
|
|
427
265
|
</li>
|
428
266
|
|
@@ -430,7 +268,7 @@
|
|
430
268
|
<li class="public ">
|
431
269
|
<span class="summary_signature">
|
432
270
|
|
433
|
-
<a href="#
|
271
|
+
<a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong> </a>
|
434
272
|
|
435
273
|
|
436
274
|
|
@@ -443,8 +281,7 @@
|
|
443
281
|
|
444
282
|
|
445
283
|
|
446
|
-
<span class="summary_desc"><div class='inline'
|
447
|
-
</div></span>
|
284
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
448
285
|
|
449
286
|
</li>
|
450
287
|
|
@@ -452,7 +289,7 @@
|
|
452
289
|
<li class="public ">
|
453
290
|
<span class="summary_signature">
|
454
291
|
|
455
|
-
<a href="#
|
292
|
+
<a href="#target-instance_method" title="#target (instance method)">- (Object) <strong>target</strong> </a>
|
456
293
|
|
457
294
|
|
458
295
|
|
@@ -465,8 +302,7 @@
|
|
465
302
|
|
466
303
|
|
467
304
|
|
468
|
-
<span class="summary_desc"><div class='inline'
|
469
|
-
</div></span>
|
305
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
470
306
|
|
471
307
|
</li>
|
472
308
|
|
@@ -475,23 +311,22 @@
|
|
475
311
|
|
476
312
|
|
477
313
|
|
478
|
-
|
479
314
|
<div id="instance_attr_details" class="attr_details">
|
480
315
|
<h2>Instance Attribute Details</h2>
|
481
316
|
|
482
317
|
|
483
|
-
<span id="
|
484
|
-
<span id="
|
318
|
+
<span id="loaded=-instance_method"></span>
|
319
|
+
<span id="loaded-instance_method"></span>
|
485
320
|
<div class="method_details first">
|
486
|
-
<p class="signature first" id="
|
321
|
+
<p class="signature first" id="loaded-instance_method">
|
487
322
|
|
488
|
-
- (<tt>Object</tt>) <strong>
|
323
|
+
- (<tt>Object</tt>) <strong>loaded</strong>
|
489
324
|
|
490
325
|
|
491
326
|
|
492
327
|
</p><div class="docstring">
|
493
328
|
<div class="discussion">
|
494
|
-
<p>Returns the value of attribute
|
329
|
+
<p>Returns the value of attribute loaded</p>
|
495
330
|
|
496
331
|
|
497
332
|
</div>
|
@@ -512,8 +347,8 @@
|
|
512
347
|
<td>
|
513
348
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 9</span>
|
514
349
|
|
515
|
-
<span class='kw'>def</span> <span class='id identifier
|
516
|
-
<span class='ivar'>@
|
350
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_loaded'>loaded</span>
|
351
|
+
<span class='ivar'>@loaded</span>
|
517
352
|
<span class='kw'>end</span></pre>
|
518
353
|
</td>
|
519
354
|
</tr>
|
@@ -521,18 +356,18 @@
|
|
521
356
|
</div>
|
522
357
|
|
523
358
|
|
524
|
-
<span id="
|
525
|
-
<span id="
|
359
|
+
<span id="name=-instance_method"></span>
|
360
|
+
<span id="name-instance_method"></span>
|
526
361
|
<div class="method_details ">
|
527
|
-
<p class="signature " id="
|
362
|
+
<p class="signature " id="name-instance_method">
|
528
363
|
|
529
|
-
- (<tt>Object</tt>) <strong>
|
364
|
+
- (<tt>Object</tt>) <strong>name</strong>
|
530
365
|
|
531
366
|
|
532
367
|
|
533
368
|
</p><div class="docstring">
|
534
369
|
<div class="discussion">
|
535
|
-
<p>Returns the value of attribute
|
370
|
+
<p>Returns the value of attribute name</p>
|
536
371
|
|
537
372
|
|
538
373
|
</div>
|
@@ -553,8 +388,8 @@
|
|
553
388
|
<td>
|
554
389
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 9</span>
|
555
390
|
|
556
|
-
<span class='kw'>def</span> <span class='id identifier
|
557
|
-
<span class='ivar'>@
|
391
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
392
|
+
<span class='ivar'>@name</span>
|
558
393
|
<span class='kw'>end</span></pre>
|
559
394
|
</td>
|
560
395
|
</tr>
|
@@ -562,18 +397,18 @@
|
|
562
397
|
</div>
|
563
398
|
|
564
399
|
|
565
|
-
<span id="
|
566
|
-
<span id="
|
400
|
+
<span id="options=-instance_method"></span>
|
401
|
+
<span id="options-instance_method"></span>
|
567
402
|
<div class="method_details ">
|
568
|
-
<p class="signature " id="
|
403
|
+
<p class="signature " id="options-instance_method">
|
569
404
|
|
570
|
-
- (<tt>Object</tt>) <strong>
|
405
|
+
- (<tt>Object</tt>) <strong>options</strong>
|
571
406
|
|
572
407
|
|
573
408
|
|
574
409
|
</p><div class="docstring">
|
575
410
|
<div class="discussion">
|
576
|
-
<p>Returns the value of attribute
|
411
|
+
<p>Returns the value of attribute options</p>
|
577
412
|
|
578
413
|
|
579
414
|
</div>
|
@@ -594,8 +429,8 @@
|
|
594
429
|
<td>
|
595
430
|
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 9</span>
|
596
431
|
|
597
|
-
<span class='kw'>def</span> <span class='id identifier
|
598
|
-
<span class='ivar'>@
|
432
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
433
|
+
<span class='ivar'>@options</span>
|
599
434
|
<span class='kw'>end</span></pre>
|
600
435
|
</td>
|
601
436
|
</tr>
|
@@ -651,93 +486,25 @@
|
|
651
486
|
|
652
487
|
|
653
488
|
<div class="method_details first">
|
654
|
-
<p class="signature first" id="
|
655
|
-
|
656
|
-
- (<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong><<</strong>(object)
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
</p><div class="docstring">
|
661
|
-
<div class="discussion">
|
662
|
-
<p>Add an object or array of objects to an association. This preserves the current records in the association (if any)
|
663
|
-
and adds the object to the target association if it is detected to exist.</p>
|
664
|
-
|
665
|
-
|
666
|
-
</div>
|
667
|
-
</div>
|
668
|
-
<div class="tags">
|
669
|
-
<h3>Parameters:</h3>
|
670
|
-
<ul class="param">
|
489
|
+
<p class="signature first" id="find_target-instance_method">
|
671
490
|
|
672
|
-
<
|
673
|
-
|
674
|
-
<span class='name'>object</span>
|
675
|
-
|
676
|
-
|
677
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
—
|
682
|
-
<div class='inline'><p>the object (or array of objects) to add to the association</p>
|
683
|
-
</div>
|
684
|
-
|
685
|
-
</li>
|
491
|
+
- (<tt>Object</tt>) <strong>find_target</strong>
|
686
492
|
|
687
|
-
</ul>
|
688
493
|
|
689
|
-
<h3>Returns:</h3>
|
690
|
-
<ul class="return">
|
691
|
-
|
692
|
-
<li>
|
693
|
-
|
694
|
-
|
695
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
—
|
700
|
-
<div class='inline'><p>the added object</p>
|
701
|
-
</div>
|
702
|
-
|
703
|
-
</li>
|
704
|
-
|
705
|
-
</ul>
|
706
|
-
<h3>Since:</h3>
|
707
|
-
<ul class="since">
|
708
494
|
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
<div class='inline'><p>0.2.0</p>
|
716
|
-
</div>
|
717
|
-
|
718
|
-
</li>
|
719
|
-
|
720
|
-
</ul>
|
721
|
-
|
722
|
-
</div><table class="source_code">
|
495
|
+
</p><table class="source_code">
|
723
496
|
<tr>
|
724
497
|
<td>
|
725
498
|
<pre class="lines">
|
726
499
|
|
727
500
|
|
728
|
-
|
729
|
-
|
730
|
-
85
|
731
|
-
86
|
732
|
-
87</pre>
|
501
|
+
34
|
502
|
+
35</pre>
|
733
503
|
</td>
|
734
504
|
<td>
|
735
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line
|
505
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 34</span>
|
736
506
|
|
737
|
-
<span class='kw'>def</span> <span class='
|
738
|
-
<span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_update_attribute'>update_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_source_attribute'>source_attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_source_ids'>source_ids</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:id</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
739
|
-
<span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_o'>o</span><span class='op'>|</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:associate_target</span><span class='comma'>,</span> <span class='id identifier rubyid_o'>o</span><span class='rparen'>)</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_target_association'>target_association</span>
|
740
|
-
<span class='id identifier rubyid_object'>object</span>
|
507
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_target'>find_target</span>
|
741
508
|
<span class='kw'>end</span></pre>
|
742
509
|
</td>
|
743
510
|
</tr>
|
@@ -745,15 +512,15 @@ and adds the object to the target association if it is detected to exist.</p>
|
|
745
512
|
</div>
|
746
513
|
|
747
514
|
<div class="method_details ">
|
748
|
-
<p class="signature " id="
|
515
|
+
<p class="signature " id="initialize-instance_method">
|
749
516
|
|
750
|
-
- (<tt
|
517
|
+
- (<tt>Dynamoid::Association</tt>) <strong>initialize</strong>(source, name, options)
|
751
518
|
|
752
519
|
|
753
520
|
|
754
521
|
</p><div class="docstring">
|
755
522
|
<div class="discussion">
|
756
|
-
<p>Create a new
|
523
|
+
<p>Create a new association.</p>
|
757
524
|
|
758
525
|
|
759
526
|
</div>
|
@@ -764,556 +531,30 @@ and adds the object to the target association if it is detected to exist.</p>
|
|
764
531
|
|
765
532
|
<li>
|
766
533
|
|
767
|
-
<span class='name'>
|
534
|
+
<span class='name'>source</span>
|
768
535
|
|
769
536
|
|
770
|
-
<span class='type'>(<tt>
|
537
|
+
<span class='type'>(<tt>Class</tt>)</span>
|
771
538
|
|
772
539
|
|
773
540
|
|
774
541
|
—
|
775
|
-
<div class='inline'><p>
|
542
|
+
<div class='inline'><p>the source record of the association; that is, the record that you already have</p>
|
776
543
|
</div>
|
777
544
|
|
778
545
|
</li>
|
779
546
|
|
780
|
-
</ul>
|
781
|
-
|
782
|
-
<h3>Returns:</h3>
|
783
|
-
<ul class="return">
|
784
|
-
|
785
547
|
<li>
|
786
548
|
|
549
|
+
<span class='name'>name</span>
|
550
|
+
|
787
551
|
|
788
|
-
<span class='type'>(<tt
|
552
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
789
553
|
|
790
554
|
|
791
555
|
|
792
556
|
—
|
793
|
-
<div class='inline'><p>the
|
794
|
-
</div>
|
795
|
-
|
796
|
-
</li>
|
797
|
-
|
798
|
-
</ul>
|
799
|
-
<h3>Since:</h3>
|
800
|
-
<ul class="since">
|
801
|
-
|
802
|
-
<li>
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
<div class='inline'><p>0.2.0</p>
|
809
|
-
</div>
|
810
|
-
|
811
|
-
</li>
|
812
|
-
|
813
|
-
</ul>
|
814
|
-
|
815
|
-
</div><table class="source_code">
|
816
|
-
<tr>
|
817
|
-
<td>
|
818
|
-
<pre class="lines">
|
819
|
-
|
820
|
-
|
821
|
-
110
|
822
|
-
111
|
823
|
-
112</pre>
|
824
|
-
</td>
|
825
|
-
<td>
|
826
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 110</span>
|
827
|
-
|
828
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
829
|
-
<span class='kw'>self</span> <span class='op'><<</span> <span class='id identifier rubyid_target_class'>target_class</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span><span class='rparen'>)</span>
|
830
|
-
<span class='kw'>end</span></pre>
|
831
|
-
</td>
|
832
|
-
</tr>
|
833
|
-
</table>
|
834
|
-
</div>
|
835
|
-
|
836
|
-
<div class="method_details ">
|
837
|
-
<p class="signature " id="create!-instance_method">
|
838
|
-
|
839
|
-
- (<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>create!</strong>(attributes = {})
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
</p><div class="docstring">
|
844
|
-
<div class="discussion">
|
845
|
-
<p>Create a new instance of the target class and add it directly to the association. If the create fails an exception will be raised.</p>
|
846
|
-
|
847
|
-
|
848
|
-
</div>
|
849
|
-
</div>
|
850
|
-
<div class="tags">
|
851
|
-
<h3>Parameters:</h3>
|
852
|
-
<ul class="param">
|
853
|
-
|
854
|
-
<li>
|
855
|
-
|
856
|
-
<span class='name'>attribute</span>
|
857
|
-
|
858
|
-
|
859
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
—
|
864
|
-
<div class='inline'><p>hash for the new object</p>
|
865
|
-
</div>
|
866
|
-
|
867
|
-
</li>
|
868
|
-
|
869
|
-
</ul>
|
870
|
-
|
871
|
-
<h3>Returns:</h3>
|
872
|
-
<ul class="return">
|
873
|
-
|
874
|
-
<li>
|
875
|
-
|
876
|
-
|
877
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
—
|
882
|
-
<div class='inline'><p>the newly-created object</p>
|
883
|
-
</div>
|
884
|
-
|
885
|
-
</li>
|
886
|
-
|
887
|
-
</ul>
|
888
|
-
<h3>Since:</h3>
|
889
|
-
<ul class="since">
|
890
|
-
|
891
|
-
<li>
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
<div class='inline'><p>0.2.0</p>
|
898
|
-
</div>
|
899
|
-
|
900
|
-
</li>
|
901
|
-
|
902
|
-
</ul>
|
903
|
-
|
904
|
-
</div><table class="source_code">
|
905
|
-
<tr>
|
906
|
-
<td>
|
907
|
-
<pre class="lines">
|
908
|
-
|
909
|
-
|
910
|
-
121
|
911
|
-
122
|
912
|
-
123</pre>
|
913
|
-
</td>
|
914
|
-
<td>
|
915
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 121</span>
|
916
|
-
|
917
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
918
|
-
<span class='kw'>self</span> <span class='op'><<</span> <span class='id identifier rubyid_target_class'>target_class</span><span class='period'>.</span><span class='id identifier rubyid_create!'>create!</span><span class='lparen'>(</span><span class='id identifier rubyid_attributes'>attributes</span><span class='rparen'>)</span>
|
919
|
-
<span class='kw'>end</span></pre>
|
920
|
-
</td>
|
921
|
-
</tr>
|
922
|
-
</table>
|
923
|
-
</div>
|
924
|
-
|
925
|
-
<div class="method_details ">
|
926
|
-
<p class="signature " id="delete-instance_method">
|
927
|
-
|
928
|
-
- (<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>delete</strong>(object)
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
</p><div class="docstring">
|
933
|
-
<div class="discussion">
|
934
|
-
<p>Deletes an object or array of objects from the association. This removes their records from the association field on the source,
|
935
|
-
and attempts to remove the source from the target association if it is detected to exist.</p>
|
936
|
-
|
937
|
-
|
938
|
-
</div>
|
939
|
-
</div>
|
940
|
-
<div class="tags">
|
941
|
-
<h3>Parameters:</h3>
|
942
|
-
<ul class="param">
|
943
|
-
|
944
|
-
<li>
|
945
|
-
|
946
|
-
<span class='name'>object</span>
|
947
|
-
|
948
|
-
|
949
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
—
|
954
|
-
<div class='inline'><p>the object (or array of objects) to remove from the association</p>
|
955
|
-
</div>
|
956
|
-
|
957
|
-
</li>
|
958
|
-
|
959
|
-
</ul>
|
960
|
-
|
961
|
-
<h3>Returns:</h3>
|
962
|
-
<ul class="return">
|
963
|
-
|
964
|
-
<li>
|
965
|
-
|
966
|
-
|
967
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
—
|
972
|
-
<div class='inline'><p>the deleted object</p>
|
973
|
-
</div>
|
974
|
-
|
975
|
-
</li>
|
976
|
-
|
977
|
-
</ul>
|
978
|
-
<h3>Since:</h3>
|
979
|
-
<ul class="since">
|
980
|
-
|
981
|
-
<li>
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
<div class='inline'><p>0.2.0</p>
|
988
|
-
</div>
|
989
|
-
|
990
|
-
</li>
|
991
|
-
|
992
|
-
</ul>
|
993
|
-
|
994
|
-
</div><table class="source_code">
|
995
|
-
<tr>
|
996
|
-
<td>
|
997
|
-
<pre class="lines">
|
998
|
-
|
999
|
-
|
1000
|
-
69
|
1001
|
-
70
|
1002
|
-
71
|
1003
|
-
72
|
1004
|
-
73</pre>
|
1005
|
-
</td>
|
1006
|
-
<td>
|
1007
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 69</span>
|
1008
|
-
|
1009
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
|
1010
|
-
<span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_update_attribute'>update_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_source_attribute'>source_attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_source_ids'>source_ids</span> <span class='op'>-</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:id</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1011
|
-
<span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_o'>o</span><span class='op'>|</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:disassociate_target</span><span class='comma'>,</span> <span class='id identifier rubyid_o'>o</span><span class='rparen'>)</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_target_association'>target_association</span>
|
1012
|
-
<span class='id identifier rubyid_object'>object</span>
|
1013
|
-
<span class='kw'>end</span></pre>
|
1014
|
-
</td>
|
1015
|
-
</tr>
|
1016
|
-
</table>
|
1017
|
-
</div>
|
1018
|
-
|
1019
|
-
<div class="method_details ">
|
1020
|
-
<p class="signature " id="delete_all-instance_method">
|
1021
|
-
|
1022
|
-
- (<tt>Object</tt>) <strong>delete_all</strong>
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
</p><div class="docstring">
|
1027
|
-
<div class="discussion">
|
1028
|
-
<p>Deletes all members of the association and removes them from the association.</p>
|
1029
|
-
|
1030
|
-
|
1031
|
-
</div>
|
1032
|
-
</div>
|
1033
|
-
<div class="tags">
|
1034
|
-
|
1035
|
-
<h3>Since:</h3>
|
1036
|
-
<ul class="since">
|
1037
|
-
|
1038
|
-
<li>
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
<div class='inline'><p>0.2.0</p>
|
1045
|
-
</div>
|
1046
|
-
|
1047
|
-
</li>
|
1048
|
-
|
1049
|
-
</ul>
|
1050
|
-
|
1051
|
-
</div><table class="source_code">
|
1052
|
-
<tr>
|
1053
|
-
<td>
|
1054
|
-
<pre class="lines">
|
1055
|
-
|
1056
|
-
|
1057
|
-
161
|
1058
|
-
162
|
1059
|
-
163
|
1060
|
-
164
|
1061
|
-
165</pre>
|
1062
|
-
</td>
|
1063
|
-
<td>
|
1064
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 161</span>
|
1065
|
-
|
1066
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_delete_all'>delete_all</span>
|
1067
|
-
<span class='id identifier rubyid_objs'>objs</span> <span class='op'>=</span> <span class='id identifier rubyid_records'>records</span>
|
1068
|
-
<span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_update_attribute'>update_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_source_attribute'>source_attribute</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1069
|
-
<span class='id identifier rubyid_objs'>objs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:delete</span><span class='rparen'>)</span>
|
1070
|
-
<span class='kw'>end</span></pre>
|
1071
|
-
</td>
|
1072
|
-
</tr>
|
1073
|
-
</table>
|
1074
|
-
</div>
|
1075
|
-
|
1076
|
-
<div class="method_details ">
|
1077
|
-
<p class="signature " id="destroy_all-instance_method">
|
1078
|
-
|
1079
|
-
- (<tt>Object</tt>) <strong>destroy_all</strong>
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
</p><div class="docstring">
|
1084
|
-
<div class="discussion">
|
1085
|
-
<p>Destroys all members of the association and removes them from the association.</p>
|
1086
|
-
|
1087
|
-
|
1088
|
-
</div>
|
1089
|
-
</div>
|
1090
|
-
<div class="tags">
|
1091
|
-
|
1092
|
-
<h3>Since:</h3>
|
1093
|
-
<ul class="since">
|
1094
|
-
|
1095
|
-
<li>
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
<div class='inline'><p>0.2.0</p>
|
1102
|
-
</div>
|
1103
|
-
|
1104
|
-
</li>
|
1105
|
-
|
1106
|
-
</ul>
|
1107
|
-
|
1108
|
-
</div><table class="source_code">
|
1109
|
-
<tr>
|
1110
|
-
<td>
|
1111
|
-
<pre class="lines">
|
1112
|
-
|
1113
|
-
|
1114
|
-
152
|
1115
|
-
153
|
1116
|
-
154
|
1117
|
-
155
|
1118
|
-
156</pre>
|
1119
|
-
</td>
|
1120
|
-
<td>
|
1121
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 152</span>
|
1122
|
-
|
1123
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_destroy_all'>destroy_all</span>
|
1124
|
-
<span class='id identifier rubyid_objs'>objs</span> <span class='op'>=</span> <span class='id identifier rubyid_records'>records</span>
|
1125
|
-
<span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_update_attribute'>update_attribute</span><span class='lparen'>(</span><span class='id identifier rubyid_source_attribute'>source_attribute</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1126
|
-
<span class='id identifier rubyid_objs'>objs</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='symbol'>:destroy</span><span class='rparen'>)</span>
|
1127
|
-
<span class='kw'>end</span></pre>
|
1128
|
-
</td>
|
1129
|
-
</tr>
|
1130
|
-
</table>
|
1131
|
-
</div>
|
1132
|
-
|
1133
|
-
<div class="method_details ">
|
1134
|
-
<p class="signature " id="each-instance_method">
|
1135
|
-
|
1136
|
-
- (<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>each</strong>(&block)
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
</p><div class="docstring">
|
1141
|
-
<div class="discussion">
|
1142
|
-
<p>Create a new instance of the target class and add it directly to the association. If the create fails an exception will be raised.</p>
|
1143
|
-
|
1144
|
-
|
1145
|
-
</div>
|
1146
|
-
</div>
|
1147
|
-
<div class="tags">
|
1148
|
-
<h3>Parameters:</h3>
|
1149
|
-
<ul class="param">
|
1150
|
-
|
1151
|
-
<li>
|
1152
|
-
|
1153
|
-
<span class='name'>attribute</span>
|
1154
|
-
|
1155
|
-
|
1156
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
—
|
1161
|
-
<div class='inline'><p>hash for the new object</p>
|
1162
|
-
</div>
|
1163
|
-
|
1164
|
-
</li>
|
1165
|
-
|
1166
|
-
</ul>
|
1167
|
-
|
1168
|
-
<h3>Returns:</h3>
|
1169
|
-
<ul class="return">
|
1170
|
-
|
1171
|
-
<li>
|
1172
|
-
|
1173
|
-
|
1174
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
—
|
1179
|
-
<div class='inline'><p>the newly-created object</p>
|
1180
|
-
</div>
|
1181
|
-
|
1182
|
-
</li>
|
1183
|
-
|
1184
|
-
</ul>
|
1185
|
-
<h3>Since:</h3>
|
1186
|
-
<ul class="since">
|
1187
|
-
|
1188
|
-
<li>
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
<div class='inline'><p>0.2.0</p>
|
1195
|
-
</div>
|
1196
|
-
|
1197
|
-
</li>
|
1198
|
-
|
1199
|
-
</ul>
|
1200
|
-
|
1201
|
-
</div><table class="source_code">
|
1202
|
-
<tr>
|
1203
|
-
<td>
|
1204
|
-
<pre class="lines">
|
1205
|
-
|
1206
|
-
|
1207
|
-
145
|
1208
|
-
146
|
1209
|
-
147</pre>
|
1210
|
-
</td>
|
1211
|
-
<td>
|
1212
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 145</span>
|
1213
|
-
|
1214
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1215
|
-
<span class='id identifier rubyid_records'>records</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1216
|
-
<span class='kw'>end</span></pre>
|
1217
|
-
</td>
|
1218
|
-
</tr>
|
1219
|
-
</table>
|
1220
|
-
</div>
|
1221
|
-
|
1222
|
-
<div class="method_details ">
|
1223
|
-
<p class="signature " id="include?-instance_method">
|
1224
|
-
|
1225
|
-
- (<tt>Boolean</tt>) <strong>include?</strong>(object)
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
</p><div class="docstring">
|
1230
|
-
<div class="discussion">
|
1231
|
-
<p>Delegate include? to the records.</p>
|
1232
|
-
|
1233
|
-
|
1234
|
-
</div>
|
1235
|
-
</div>
|
1236
|
-
<div class="tags">
|
1237
|
-
|
1238
|
-
<h3>Returns:</h3>
|
1239
|
-
<ul class="return">
|
1240
|
-
|
1241
|
-
<li>
|
1242
|
-
|
1243
|
-
|
1244
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
</li>
|
1249
|
-
|
1250
|
-
</ul>
|
1251
|
-
|
1252
|
-
</div><table class="source_code">
|
1253
|
-
<tr>
|
1254
|
-
<td>
|
1255
|
-
<pre class="lines">
|
1256
|
-
|
1257
|
-
|
1258
|
-
55
|
1259
|
-
56
|
1260
|
-
57</pre>
|
1261
|
-
</td>
|
1262
|
-
<td>
|
1263
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 55</span>
|
1264
|
-
|
1265
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
|
1266
|
-
<span class='id identifier rubyid_records'>records</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span>
|
1267
|
-
<span class='kw'>end</span></pre>
|
1268
|
-
</td>
|
1269
|
-
</tr>
|
1270
|
-
</table>
|
1271
|
-
</div>
|
1272
|
-
|
1273
|
-
<div class="method_details ">
|
1274
|
-
<p class="signature " id="initialize-instance_method">
|
1275
|
-
|
1276
|
-
- (<tt>Dynamoid::Association</tt>) <strong>initialize</strong>(source, name, options)
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
</p><div class="docstring">
|
1281
|
-
<div class="discussion">
|
1282
|
-
<p>Create a new association.</p>
|
1283
|
-
|
1284
|
-
|
1285
|
-
</div>
|
1286
|
-
</div>
|
1287
|
-
<div class="tags">
|
1288
|
-
<h3>Parameters:</h3>
|
1289
|
-
<ul class="param">
|
1290
|
-
|
1291
|
-
<li>
|
1292
|
-
|
1293
|
-
<span class='name'>source</span>
|
1294
|
-
|
1295
|
-
|
1296
|
-
<span class='type'>(<tt>Class</tt>)</span>
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
—
|
1301
|
-
<div class='inline'><p>the source record of the association; that is, the record that you already have</p>
|
1302
|
-
</div>
|
1303
|
-
|
1304
|
-
</li>
|
1305
|
-
|
1306
|
-
<li>
|
1307
|
-
|
1308
|
-
<span class='name'>name</span>
|
1309
|
-
|
1310
|
-
|
1311
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
—
|
1316
|
-
<div class='inline'><p>the name of the association</p>
|
557
|
+
<div class='inline'><p>the name of the association</p>
|
1317
558
|
</div>
|
1318
559
|
|
1319
560
|
</li>
|
@@ -1400,21 +641,21 @@ and attempts to remove the source from the target association if it is detected
|
|
1400
641
|
<pre class="lines">
|
1401
642
|
|
1402
643
|
|
644
|
+
23
|
645
|
+
24
|
646
|
+
25
|
647
|
+
26
|
1403
648
|
27
|
1404
|
-
28
|
1405
|
-
29
|
1406
|
-
30
|
1407
|
-
31
|
1408
|
-
32</pre>
|
649
|
+
28</pre>
|
1409
650
|
</td>
|
1410
651
|
<td>
|
1411
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line
|
652
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 23</span>
|
1412
653
|
|
1413
654
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_source'>source</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1414
655
|
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
1415
656
|
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
|
1416
657
|
<span class='ivar'>@source</span> <span class='op'>=</span> <span class='id identifier rubyid_source'>source</span>
|
1417
|
-
<span class='ivar'>@
|
658
|
+
<span class='ivar'>@loaded</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1418
659
|
<span class='kw'>end</span></pre>
|
1419
660
|
</td>
|
1420
661
|
</tr>
|
@@ -1422,20 +663,15 @@ and attempts to remove the source from the target association if it is detected
|
|
1422
663
|
</div>
|
1423
664
|
|
1424
665
|
<div class="method_details ">
|
1425
|
-
<p class="signature " id="
|
666
|
+
<p class="signature " id="loaded?-instance_method">
|
1426
667
|
|
1427
|
-
- (<tt>
|
668
|
+
- (<tt>Boolean</tt>) <strong>loaded?</strong>
|
1428
669
|
|
1429
670
|
|
1430
671
|
|
1431
|
-
<span class="aliases">Also known as:
|
1432
|
-
<span class="names"><span id='all-instance_method'>all</span></span>
|
1433
|
-
</span>
|
1434
|
-
|
1435
672
|
</p><div class="docstring">
|
1436
673
|
<div class="discussion">
|
1437
|
-
|
1438
|
-
|
674
|
+
|
1439
675
|
|
1440
676
|
</div>
|
1441
677
|
</div>
|
@@ -1447,28 +683,9 @@ and attempts to remove the source from the target association if it is detected
|
|
1447
683
|
<li>
|
1448
684
|
|
1449
685
|
|
1450
|
-
<span class='type'
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
<div class='inline'><p>the association records; depending on which association this is, either a single instance or an array</p>
|
1456
|
-
</div>
|
1457
|
-
|
1458
|
-
</li>
|
1459
|
-
|
1460
|
-
</ul>
|
1461
|
-
<h3>Since:</h3>
|
1462
|
-
<ul class="since">
|
1463
|
-
|
1464
|
-
<li>
|
1465
|
-
|
1466
|
-
|
686
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1467
687
|
|
1468
688
|
|
1469
|
-
|
1470
|
-
<div class='inline'><p>0.2.0</p>
|
1471
|
-
</div>
|
1472
689
|
|
1473
690
|
</li>
|
1474
691
|
|
@@ -1480,27 +697,15 @@ and attempts to remove the source from the target association if it is detected
|
|
1480
697
|
<pre class="lines">
|
1481
698
|
|
1482
699
|
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
46
|
1487
|
-
47
|
1488
|
-
48
|
1489
|
-
49
|
1490
|
-
50
|
1491
|
-
51</pre>
|
700
|
+
30
|
701
|
+
31
|
702
|
+
32</pre>
|
1492
703
|
</td>
|
1493
704
|
<td>
|
1494
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line
|
1495
|
-
|
1496
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_records'>records</span>
|
1497
|
-
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='const'>Array</span><span class='lparen'>(</span><span class='id identifier rubyid_target_class'>target_class</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_source_ids'>source_ids</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
705
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 30</span>
|
1498
706
|
|
1499
|
-
|
1500
|
-
|
1501
|
-
<span class='kw'>else</span>
|
1502
|
-
<span class='id identifier rubyid_results_with_query'>results_with_query</span><span class='lparen'>(</span><span class='id identifier rubyid_results'>results</span><span class='rparen'>)</span>
|
1503
|
-
<span class='kw'>end</span>
|
707
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_loaded?'>loaded?</span>
|
708
|
+
<span class='ivar'>@loaded</span>
|
1504
709
|
<span class='kw'>end</span></pre>
|
1505
710
|
</td>
|
1506
711
|
</tr>
|
@@ -1508,93 +713,29 @@ and attempts to remove the source from the target association if it is detected
|
|
1508
713
|
</div>
|
1509
714
|
|
1510
715
|
<div class="method_details ">
|
1511
|
-
<p class="signature " id="
|
1512
|
-
|
1513
|
-
- (<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>) <strong>setter</strong>(object)
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
</p><div class="docstring">
|
1518
|
-
<div class="discussion">
|
1519
|
-
<p>Replace an association with object or array of objects. This removes all of the existing associated records and replaces them with
|
1520
|
-
the passed object(s), and associates the target association if it is detected to exist.</p>
|
1521
|
-
|
1522
|
-
|
1523
|
-
</div>
|
1524
|
-
</div>
|
1525
|
-
<div class="tags">
|
1526
|
-
<h3>Parameters:</h3>
|
1527
|
-
<ul class="param">
|
716
|
+
<p class="signature " id="reset-instance_method">
|
1528
717
|
|
1529
|
-
<
|
1530
|
-
|
1531
|
-
<span class='name'>object</span>
|
1532
|
-
|
1533
|
-
|
1534
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
—
|
1539
|
-
<div class='inline'><p>the object (or array of objects) to add to the association</p>
|
1540
|
-
</div>
|
1541
|
-
|
1542
|
-
</li>
|
718
|
+
- (<tt>Object</tt>) <strong>reset</strong>
|
1543
719
|
|
1544
|
-
</ul>
|
1545
720
|
|
1546
|
-
<h3>Returns:</h3>
|
1547
|
-
<ul class="return">
|
1548
|
-
|
1549
|
-
<li>
|
1550
|
-
|
1551
|
-
|
1552
|
-
<span class='type'>(<tt><span class='object_link'><a href="../Document.html" title="Dynamoid::Document (module)">Dynamoid::Document</a></span></tt>)</span>
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
—
|
1557
|
-
<div class='inline'><p>the added object</p>
|
1558
|
-
</div>
|
1559
|
-
|
1560
|
-
</li>
|
1561
|
-
|
1562
|
-
</ul>
|
1563
|
-
<h3>Since:</h3>
|
1564
|
-
<ul class="since">
|
1565
|
-
|
1566
|
-
<li>
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
<div class='inline'><p>0.2.0</p>
|
1573
|
-
</div>
|
1574
|
-
|
1575
|
-
</li>
|
1576
721
|
|
1577
|
-
</
|
1578
|
-
|
1579
|
-
</div><table class="source_code">
|
722
|
+
</p><table class="source_code">
|
1580
723
|
<tr>
|
1581
724
|
<td>
|
1582
725
|
<pre class="lines">
|
1583
726
|
|
1584
727
|
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
101</pre>
|
728
|
+
46
|
729
|
+
47
|
730
|
+
48
|
731
|
+
49</pre>
|
1590
732
|
</td>
|
1591
733
|
<td>
|
1592
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line
|
734
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 46</span>
|
1593
735
|
|
1594
|
-
<span class='kw'>def</span> <span class='id identifier
|
1595
|
-
<span class='
|
1596
|
-
<span class='
|
1597
|
-
<span class='id identifier rubyid_object'>object</span>
|
736
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
|
737
|
+
<span class='ivar'>@target</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
738
|
+
<span class='ivar'>@loaded</span> <span class='op'>=</span> <span class='kw'>false</span>
|
1598
739
|
<span class='kw'>end</span></pre>
|
1599
740
|
</td>
|
1600
741
|
</tr>
|
@@ -1602,90 +743,37 @@ the passed object(s), and associates the target association if it is detected to
|
|
1602
743
|
</div>
|
1603
744
|
|
1604
745
|
<div class="method_details ">
|
1605
|
-
<p class="signature " id="
|
1606
|
-
|
1607
|
-
- (<tt>Dynamoid::Association</tt>) <strong>where</strong>(args)
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
</p><div class="docstring">
|
1612
|
-
<div class="discussion">
|
1613
|
-
<p>Naive association filtering.</p>
|
1614
|
-
|
1615
|
-
|
1616
|
-
</div>
|
1617
|
-
</div>
|
1618
|
-
<div class="tags">
|
1619
|
-
<h3>Parameters:</h3>
|
1620
|
-
<ul class="param">
|
746
|
+
<p class="signature " id="target-instance_method">
|
1621
747
|
|
1622
|
-
<
|
1623
|
-
|
1624
|
-
<span class='name'>A</span>
|
1625
|
-
|
1626
|
-
|
1627
|
-
<span class='type'>(<tt>Hash</tt>)</span>
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
—
|
1632
|
-
<div class='inline'><p>hash of attributes; each must match every returned object's attribute exactly.</p>
|
1633
|
-
</div>
|
1634
|
-
|
1635
|
-
</li>
|
748
|
+
- (<tt>Object</tt>) <strong>target</strong>
|
1636
749
|
|
1637
|
-
</ul>
|
1638
750
|
|
1639
|
-
<h3>Returns:</h3>
|
1640
|
-
<ul class="return">
|
1641
751
|
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
<span class='type'>(<tt>Dynamoid::Association</tt>)</span>
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
—
|
1650
|
-
<div class='inline'><p>the association this method was called on (for chaining purposes)</p>
|
1651
|
-
</div>
|
1652
|
-
|
1653
|
-
</li>
|
1654
|
-
|
1655
|
-
</ul>
|
1656
|
-
<h3>Since:</h3>
|
1657
|
-
<ul class="since">
|
1658
|
-
|
1659
|
-
<li>
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
<div class='inline'><p>0.2.0</p>
|
1666
|
-
</div>
|
1667
|
-
|
1668
|
-
</li>
|
1669
|
-
|
1670
|
-
</ul>
|
1671
|
-
|
1672
|
-
</div><table class="source_code">
|
752
|
+
</p><table class="source_code">
|
1673
753
|
<tr>
|
1674
754
|
<td>
|
1675
755
|
<pre class="lines">
|
1676
756
|
|
1677
757
|
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
758
|
+
37
|
759
|
+
38
|
760
|
+
39
|
761
|
+
40
|
762
|
+
41
|
763
|
+
42
|
764
|
+
43
|
765
|
+
44</pre>
|
1682
766
|
</td>
|
1683
767
|
<td>
|
1684
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line
|
768
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid/associations/association.rb', line 37</span>
|
769
|
+
|
770
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_target'>target</span>
|
771
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_loaded?'>loaded?</span>
|
772
|
+
<span class='ivar'>@target</span> <span class='op'>=</span> <span class='id identifier rubyid_find_target'>find_target</span>
|
773
|
+
<span class='ivar'>@loaded</span> <span class='op'>=</span> <span class='kw'>true</span>
|
774
|
+
<span class='kw'>end</span>
|
1685
775
|
|
1686
|
-
<span class='
|
1687
|
-
<span class='id identifier rubyid_args'>args</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_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='rbrace'>}</span>
|
1688
|
-
<span class='kw'>self</span>
|
776
|
+
<span class='ivar'>@target</span>
|
1689
777
|
<span class='kw'>end</span></pre>
|
1690
778
|
</td>
|
1691
779
|
</tr>
|
@@ -1697,7 +785,7 @@ the passed object(s), and associates the target association if it is detected to
|
|
1697
785
|
</div>
|
1698
786
|
|
1699
787
|
<div id="footer">
|
1700
|
-
Generated on
|
788
|
+
Generated on Thu Apr 26 01:26:26 2012 by
|
1701
789
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1702
790
|
0.7.5 (ruby-1.9.3).
|
1703
791
|
</div>
|