simplesync 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/LICENSE +16 -0
  2. data/README +40 -0
  3. data/Rakefile +78 -0
  4. data/doc/classes/Hash.html +153 -0
  5. data/doc/classes/Hash.src/M000001.html +28 -0
  6. data/doc/classes/SimpleSync.html +121 -0
  7. data/doc/classes/SimpleSync/Mappings.html +169 -0
  8. data/doc/classes/SimpleSync/Mappings.src/M000026.html +19 -0
  9. data/doc/classes/SimpleSync/Mappings.src/M000027.html +20 -0
  10. data/doc/classes/SimpleSync/Record.html +188 -0
  11. data/doc/classes/SimpleSync/Record.src/M000002.html +22 -0
  12. data/doc/classes/SimpleSync/Record.src/M000003.html +23 -0
  13. data/doc/classes/SimpleSync/Record.src/M000004.html +25 -0
  14. data/doc/classes/SimpleSync/RecordSet.html +235 -0
  15. data/doc/classes/SimpleSync/RecordSet.src/M000028.html +23 -0
  16. data/doc/classes/SimpleSync/RecordSet.src/M000029.html +18 -0
  17. data/doc/classes/SimpleSync/RecordSet.src/M000030.html +19 -0
  18. data/doc/classes/SimpleSync/RecordSet.src/M000031.html +20 -0
  19. data/doc/classes/SimpleSync/RecordSet.src/M000032.html +18 -0
  20. data/doc/classes/SimpleSync/Source.html +356 -0
  21. data/doc/classes/SimpleSync/Source.src/M000005.html +19 -0
  22. data/doc/classes/SimpleSync/Source.src/M000006.html +19 -0
  23. data/doc/classes/SimpleSync/Source.src/M000007.html +19 -0
  24. data/doc/classes/SimpleSync/Source.src/M000008.html +22 -0
  25. data/doc/classes/SimpleSync/Source.src/M000009.html +18 -0
  26. data/doc/classes/SimpleSync/Source.src/M000010.html +20 -0
  27. data/doc/classes/SimpleSync/Source.src/M000011.html +22 -0
  28. data/doc/classes/SimpleSync/Source.src/M000012.html +18 -0
  29. data/doc/classes/SimpleSync/Source.src/M000013.html +18 -0
  30. data/doc/classes/SimpleSync/Syncer.html +408 -0
  31. data/doc/classes/SimpleSync/Syncer.src/M000014.html +18 -0
  32. data/doc/classes/SimpleSync/Syncer.src/M000015.html +18 -0
  33. data/doc/classes/SimpleSync/Syncer.src/M000016.html +18 -0
  34. data/doc/classes/SimpleSync/Syncer.src/M000017.html +18 -0
  35. data/doc/classes/SimpleSync/Syncer.src/M000018.html +18 -0
  36. data/doc/classes/SimpleSync/Syncer.src/M000019.html +18 -0
  37. data/doc/classes/SimpleSync/Syncer.src/M000020.html +18 -0
  38. data/doc/classes/SimpleSync/Syncer.src/M000021.html +18 -0
  39. data/doc/classes/SimpleSync/Syncer.src/M000022.html +35 -0
  40. data/doc/classes/SimpleSync/Syncer.src/M000023.html +44 -0
  41. data/doc/classes/SimpleSync/Syncer.src/M000024.html +41 -0
  42. data/doc/classes/SimpleSync/Syncer.src/M000025.html +25 -0
  43. data/doc/created.rid +1 -0
  44. data/doc/files/LICENSE.html +129 -0
  45. data/doc/files/README.html +155 -0
  46. data/doc/files/lib/simple_sync_rb.html +107 -0
  47. data/doc/fr_class_index.html +33 -0
  48. data/doc/fr_file_index.html +29 -0
  49. data/doc/fr_method_index.html +58 -0
  50. data/doc/index.html +24 -0
  51. data/doc/rdoc-style.css +208 -0
  52. data/lib/simple_sync.rb +387 -0
  53. metadata +115 -0
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>snapshot! (SimpleSync::RecordSet)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/simple_sync.rb, line 268</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot!</span>
15
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@getter</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>)
16
+ <span class="ruby-identifier">clear</span>
17
+ <span class="ruby-keyword kw">self</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@getter</span>.<span class="ruby-identifier">call</span>
18
+ <span class="ruby-keyword kw">else</span>
19
+ <span class="ruby-keyword kw">nil</span>
20
+ <span class="ruby-keyword kw">end</span>
21
+ <span class="ruby-keyword kw">end</span></pre>
22
+ </body>
23
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>set (SimpleSync::RecordSet)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/simple_sync.rb, line 279</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>
15
+ <span class="ruby-ivar">@set</span> <span class="ruby-operator">||=</span> []
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>delete (SimpleSync::RecordSet)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/simple_sync.rb, line 296</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">record_or_identifier</span>)
15
+ <span class="ruby-identifier">identifier</span> = <span class="ruby-identifier">get_mapped_identifier</span>(<span class="ruby-identifier">record_or_identifier</span>)
16
+ <span class="ruby-operator">!</span><span class="ruby-operator">!</span>(<span class="ruby-identifier">set</span>.<span class="ruby-identifier">reject!</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">identifier</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">identifier</span>})
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>find (SimpleSync::RecordSet)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/simple_sync.rb, line 302</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">record</span>)
15
+ <span class="ruby-comment cmt"># ident_key = source.mapping_to(record.source)[source.identifier.to_s]</span>
16
+ <span class="ruby-comment cmt"># ident = {source.identifier.to_s =&gt; record.send(ident_key)}</span>
17
+ <span class="ruby-identifier">set</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">identifier</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">record</span>.<span class="ruby-identifier">identifier</span>}[<span class="ruby-value">0</span>]
18
+ <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html>
7
+ <head>
8
+ <title>clear (SimpleSync::RecordSet)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/simple_sync.rb, line 313</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
15
+ <span class="ruby-identifier">set</span>.<span class="ruby-identifier">clear</span>
16
+ <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,356 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: SimpleSync::Source</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">SimpleSync::Source</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/simple_sync_rb.html">
59
+ lib/simple_sync.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ <a href="Source.html">Source</a> represents each sync source. There may be
84
+ more than two. A source must be tied to a <a href="Syncer.html">Syncer</a>
85
+ (use <a href="Syncer.html#M000017">Syncer#add_source</a> to create
86
+ sources), and any two sources must have mappings defined between them.
87
+ </p>
88
+
89
+ </div>
90
+
91
+
92
+ </div>
93
+
94
+ <div id="method-list">
95
+ <h3 class="section-bar">Methods</h3>
96
+
97
+ <div class="name-list">
98
+ <a href="#M000013">can_map?</a>&nbsp;&nbsp;
99
+ <a href="#M000006">changed_records</a>&nbsp;&nbsp;
100
+ <a href="#M000007">deleted_records</a>&nbsp;&nbsp;
101
+ <a href="#M000009">get</a>&nbsp;&nbsp;
102
+ <a href="#M000010">initialize_record</a>&nbsp;&nbsp;
103
+ <a href="#M000012">mapping_to</a>&nbsp;&nbsp;
104
+ <a href="#M000008">new</a>&nbsp;&nbsp;
105
+ <a href="#M000005">new_records</a>&nbsp;&nbsp;
106
+ <a href="#M000011">snapshot!</a>&nbsp;&nbsp;
107
+ </div>
108
+ </div>
109
+
110
+ </div>
111
+
112
+
113
+ <!-- if includes -->
114
+
115
+ <div id="section">
116
+
117
+
118
+
119
+
120
+
121
+ <div id="attribute-list">
122
+ <h3 class="section-bar">Attributes</h3>
123
+
124
+ <div class="name-list">
125
+ <table>
126
+ <tr class="top-aligned-row context-row">
127
+ <td class="context-item-name">finder_scope</td>
128
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
129
+ <td class="context-item-desc"></td>
130
+ </tr>
131
+ <tr class="top-aligned-row context-row">
132
+ <td class="context-item-name">identifier</td>
133
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
134
+ <td class="context-item-desc"></td>
135
+ </tr>
136
+ <tr class="top-aligned-row context-row">
137
+ <td class="context-item-name">klass</td>
138
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
139
+ <td class="context-item-desc"></td>
140
+ </tr>
141
+ <tr class="top-aligned-row context-row">
142
+ <td class="context-item-name">mappings</td>
143
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
144
+ <td class="context-item-desc"></td>
145
+ </tr>
146
+ <tr class="top-aligned-row context-row">
147
+ <td class="context-item-name">targets</td>
148
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
149
+ <td class="context-item-desc"></td>
150
+ </tr>
151
+ </table>
152
+ </div>
153
+ </div>
154
+
155
+
156
+
157
+ <!-- if method_list -->
158
+ <div id="methods">
159
+ <h3 class="section-bar">Public Class methods</h3>
160
+
161
+ <div id="method-M000008" class="method-detail">
162
+ <a name="M000008"></a>
163
+
164
+ <div class="method-heading">
165
+ <a href="Source.src/M000008.html" target="Code" class="method-signature"
166
+ onclick="popupCode('Source.src/M000008.html');return false;">
167
+ <span class="method-name">new</span><span class="method-args">(klass, identifier, mappings, finder_scope, &amp;block)</span>
168
+ </a>
169
+ </div>
170
+
171
+ <div class="method-description">
172
+ <p>
173
+ Creates a <a href="Source.html#M000008">new</a> <a
174
+ href="Source.html">Source</a> object. Use <a
175
+ href="Syncer.html#M000017">Syncer#add_source</a> unless you know why you
176
+ want to call this directly. If a block is supplied, it is understood to be
177
+ a block to be run on a newly-created record object of this source type.
178
+ </p>
179
+ </div>
180
+ </div>
181
+
182
+ <h3 class="section-bar">Public Instance methods</h3>
183
+
184
+ <div id="method-M000013" class="method-detail">
185
+ <a name="M000013"></a>
186
+
187
+ <div class="method-heading">
188
+ <a href="Source.src/M000013.html" target="Code" class="method-signature"
189
+ onclick="popupCode('Source.src/M000013.html');return false;">
190
+ <span class="method-name">can_map?</span><span class="method-args">(target)</span>
191
+ </a>
192
+ </div>
193
+
194
+ <div class="method-description">
195
+ <p>
196
+ Returns true or false after checking to see if mappings are defined in
197
+ source.mappings[source =&gt; target].
198
+ </p>
199
+ </div>
200
+ </div>
201
+
202
+ <div id="method-M000006" class="method-detail">
203
+ <a name="M000006"></a>
204
+
205
+ <div class="method-heading">
206
+ <a href="Source.src/M000006.html" target="Code" class="method-signature"
207
+ onclick="popupCode('Source.src/M000006.html');return false;">
208
+ <span class="method-name">changed_records</span><span class="method-args">(&amp;block)</span>
209
+ </a>
210
+ </div>
211
+
212
+ <div class="method-description">
213
+ <p>
214
+ When called with a block, that block is stored for use when <a
215
+ href="Source.html#M000011">snapshot!</a> is called, in order to retrieve
216
+ the <a href="Source.html#M000006">changed_records</a> from the source.
217
+ Whether a block is given or not, a <a href="RecordSet.html">RecordSet</a>
218
+ object is returned that holds the current known list of <a
219
+ href="Source.html#M000006">changed_records</a> for this source.
220
+ </p>
221
+ </div>
222
+ </div>
223
+
224
+ <div id="method-M000007" class="method-detail">
225
+ <a name="M000007"></a>
226
+
227
+ <div class="method-heading">
228
+ <a href="Source.src/M000007.html" target="Code" class="method-signature"
229
+ onclick="popupCode('Source.src/M000007.html');return false;">
230
+ <span class="method-name">deleted_records</span><span class="method-args">(&amp;block)</span>
231
+ </a>
232
+ </div>
233
+
234
+ <div class="method-description">
235
+ <p>
236
+ When called with a block, that block is stored for use when <a
237
+ href="Source.html#M000011">snapshot!</a> is called, in order to retrieve
238
+ the <a href="Source.html#M000007">deleted_records</a> from the source.
239
+ Whether a block is given or not, a <a href="RecordSet.html">RecordSet</a>
240
+ object is returned that holds the current known list of <a
241
+ href="Source.html#M000007">deleted_records</a> for this source.
242
+ </p>
243
+ </div>
244
+ </div>
245
+
246
+ <div id="method-M000009" class="method-detail">
247
+ <a name="M000009"></a>
248
+
249
+ <div class="method-heading">
250
+ <a href="Source.src/M000009.html" target="Code" class="method-signature"
251
+ onclick="popupCode('Source.src/M000009.html');return false;">
252
+ <span class="method-name">get</span><span class="method-args">(finder_options={})</span>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="method-description">
257
+ <p>
258
+ Calls klass.get with the :finder_scope option(s) merged into the
259
+ finder_options.
260
+ </p>
261
+ </div>
262
+ </div>
263
+
264
+ <div id="method-M000010" class="method-detail">
265
+ <a name="M000010"></a>
266
+
267
+ <div class="method-heading">
268
+ <a href="Source.src/M000010.html" target="Code" class="method-signature"
269
+ onclick="popupCode('Source.src/M000010.html');return false;">
270
+ <span class="method-name">initialize_record</span><span class="method-args">(record)</span>
271
+ </a>
272
+ </div>
273
+
274
+ <div class="method-description">
275
+ <p>
276
+ Initializes a record retrieved by the <a
277
+ href="../SimpleSync.html">SimpleSync</a> gem. Simply runs the block
278
+ supplied to the <a href="Source.html">Source</a> object creation, if one
279
+ was given.
280
+ </p>
281
+ </div>
282
+ </div>
283
+
284
+ <div id="method-M000012" class="method-detail">
285
+ <a name="M000012"></a>
286
+
287
+ <div class="method-heading">
288
+ <a href="Source.src/M000012.html" target="Code" class="method-signature"
289
+ onclick="popupCode('Source.src/M000012.html');return false;">
290
+ <span class="method-name">mapping_to</span><span class="method-args">(target)</span>
291
+ </a>
292
+ </div>
293
+
294
+ <div class="method-description">
295
+ <p>
296
+ source.mapping_to(target) is synonymous to source.mappings[source =&gt;
297
+ target].
298
+ </p>
299
+ </div>
300
+ </div>
301
+
302
+ <div id="method-M000005" class="method-detail">
303
+ <a name="M000005"></a>
304
+
305
+ <div class="method-heading">
306
+ <a href="Source.src/M000005.html" target="Code" class="method-signature"
307
+ onclick="popupCode('Source.src/M000005.html');return false;">
308
+ <span class="method-name">new_records</span><span class="method-args">(&amp;block)</span>
309
+ </a>
310
+ </div>
311
+
312
+ <div class="method-description">
313
+ <p>
314
+ When called with a block, that block is stored for use when <a
315
+ href="Source.html#M000011">snapshot!</a> is called, in order to retrieve
316
+ the <a href="Source.html#M000005">new_records</a> from the source. Whether
317
+ a block is given or not, a <a href="RecordSet.html">RecordSet</a> object is
318
+ returned that holds the current known list of <a
319
+ href="Source.html#M000005">new_records</a> for this source.
320
+ </p>
321
+ </div>
322
+ </div>
323
+
324
+ <div id="method-M000011" class="method-detail">
325
+ <a name="M000011"></a>
326
+
327
+ <div class="method-heading">
328
+ <a href="Source.src/M000011.html" target="Code" class="method-signature"
329
+ onclick="popupCode('Source.src/M000011.html');return false;">
330
+ <span class="method-name">snapshot!</span><span class="method-args">()</span>
331
+ </a>
332
+ </div>
333
+
334
+ <div class="method-description">
335
+ <p>
336
+ Takes a snapshot of <a href="Source.html#M000005">new_records</a>, <a
337
+ href="Source.html#M000006">changed_records</a> and <a
338
+ href="Source.html#M000007">deleted_records</a>. Returns self (the <a
339
+ href="Source.html">Source</a> object).
340
+ </p>
341
+ </div>
342
+ </div>
343
+
344
+
345
+ </div>
346
+
347
+
348
+ </div>
349
+
350
+
351
+ <div id="validator-badges">
352
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
353
+ </div>
354
+
355
+ </body>
356
+ </html>