simplesync 0.0.2
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/LICENSE +16 -0
- data/README +40 -0
- data/Rakefile +78 -0
- data/doc/classes/Hash.html +153 -0
- data/doc/classes/Hash.src/M000001.html +28 -0
- data/doc/classes/SimpleSync.html +121 -0
- data/doc/classes/SimpleSync/Mappings.html +169 -0
- data/doc/classes/SimpleSync/Mappings.src/M000026.html +19 -0
- data/doc/classes/SimpleSync/Mappings.src/M000027.html +20 -0
- data/doc/classes/SimpleSync/Record.html +188 -0
- data/doc/classes/SimpleSync/Record.src/M000002.html +22 -0
- data/doc/classes/SimpleSync/Record.src/M000003.html +23 -0
- data/doc/classes/SimpleSync/Record.src/M000004.html +25 -0
- data/doc/classes/SimpleSync/RecordSet.html +235 -0
- data/doc/classes/SimpleSync/RecordSet.src/M000028.html +23 -0
- data/doc/classes/SimpleSync/RecordSet.src/M000029.html +18 -0
- data/doc/classes/SimpleSync/RecordSet.src/M000030.html +19 -0
- data/doc/classes/SimpleSync/RecordSet.src/M000031.html +20 -0
- data/doc/classes/SimpleSync/RecordSet.src/M000032.html +18 -0
- data/doc/classes/SimpleSync/Source.html +356 -0
- data/doc/classes/SimpleSync/Source.src/M000005.html +19 -0
- data/doc/classes/SimpleSync/Source.src/M000006.html +19 -0
- data/doc/classes/SimpleSync/Source.src/M000007.html +19 -0
- data/doc/classes/SimpleSync/Source.src/M000008.html +22 -0
- data/doc/classes/SimpleSync/Source.src/M000009.html +18 -0
- data/doc/classes/SimpleSync/Source.src/M000010.html +20 -0
- data/doc/classes/SimpleSync/Source.src/M000011.html +22 -0
- data/doc/classes/SimpleSync/Source.src/M000012.html +18 -0
- data/doc/classes/SimpleSync/Source.src/M000013.html +18 -0
- data/doc/classes/SimpleSync/Syncer.html +408 -0
- data/doc/classes/SimpleSync/Syncer.src/M000014.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000015.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000016.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000017.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000018.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000019.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000020.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000021.html +18 -0
- data/doc/classes/SimpleSync/Syncer.src/M000022.html +35 -0
- data/doc/classes/SimpleSync/Syncer.src/M000023.html +44 -0
- data/doc/classes/SimpleSync/Syncer.src/M000024.html +41 -0
- data/doc/classes/SimpleSync/Syncer.src/M000025.html +25 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +129 -0
- data/doc/files/README.html +155 -0
- data/doc/files/lib/simple_sync_rb.html +107 -0
- data/doc/fr_class_index.html +33 -0
- data/doc/fr_file_index.html +29 -0
- data/doc/fr_method_index.html +58 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/simple_sync.rb +387 -0
- metadata +115 -0
@@ -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>new_records (SimpleSync::Source)</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 190</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_records</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">new_records</span>.<span class="ruby-identifier">getter</span> = <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
16
|
+
<span class="ruby-ivar">@new_records</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RecordSet</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</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>changed_records (SimpleSync::Source)</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 197</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">changed_records</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">changed_records</span>.<span class="ruby-identifier">getter</span> = <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
16
|
+
<span class="ruby-ivar">@changed_records</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RecordSet</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</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>deleted_records (SimpleSync::Source)</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 204</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deleted_records</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-identifier">deleted_records</span>.<span class="ruby-identifier">getter</span> = <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
16
|
+
<span class="ruby-ivar">@deleted_records</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">RecordSet</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
17
|
+
<span class="ruby-keyword kw">end</span></pre>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
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>new (SimpleSync::Source)</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 211</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">klass</span>, <span class="ruby-identifier">identifier</span>, <span class="ruby-identifier">mappings</span>, <span class="ruby-identifier">finder_scope</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
15
|
+
<span class="ruby-ivar">@klass</span> = <span class="ruby-identifier">klass</span>
|
16
|
+
<span class="ruby-ivar">@identifier</span> = <span class="ruby-identifier">identifier</span>
|
17
|
+
<span class="ruby-ivar">@mappings</span> = <span class="ruby-identifier">mappings</span>
|
18
|
+
<span class="ruby-ivar">@finder_scope</span> = <span class="ruby-identifier">finder_scope</span>
|
19
|
+
<span class="ruby-ivar">@initialize</span> = <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</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>get (SimpleSync::Source)</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 220</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">finder_options</span>={})
|
15
|
+
<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">finder_options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-ivar">@finder_scope</span> <span class="ruby-operator">||</span> {}))
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</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>initialize_record (SimpleSync::Source)</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 225</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize_record</span>(<span class="ruby-identifier">record</span>)
|
15
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">record</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@initialize</span>.<span class="ruby-identifier">nil?</span>
|
16
|
+
<span class="ruby-identifier">record</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:eval</span>, <span class="ruby-ivar">@initialize</span>.<span class="ruby-identifier">to_ruby</span>).<span class="ruby-identifier">call</span>
|
17
|
+
<span class="ruby-identifier">record</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
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::Source)</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 236</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snapshot!</span>
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-value str">"Must send new_records, changed_records, and deleted_records each a block before this function can be run"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@new_records_getter</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@changed_records_getter</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@deleted_records_getter</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Proc</span>)
|
16
|
+
<span class="ruby-identifier">new_records</span>.<span class="ruby-identifier">snapshot!</span>
|
17
|
+
<span class="ruby-identifier">changed_records</span>.<span class="ruby-identifier">snapshot!</span>
|
18
|
+
<span class="ruby-identifier">deleted_records</span>.<span class="ruby-identifier">snapshot!</span>
|
19
|
+
<span class="ruby-keyword kw">self</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</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>mapping_to (SimpleSync::Source)</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 245</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mapping_to</span>(<span class="ruby-identifier">target</span>)
|
15
|
+
<span class="ruby-identifier">mappings</span>[<span class="ruby-keyword kw">self</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">target</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">to_s</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">to_s</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</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>can_map? (SimpleSync::Source)</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 249</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_map?</span>(<span class="ruby-identifier">target</span>)
|
15
|
+
<span class="ruby-operator">!</span><span class="ruby-identifier">mappings</span>[<span class="ruby-keyword kw">self</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">target</span>].<span class="ruby-identifier">empty?</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,408 @@
|
|
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::Syncer</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::Syncer</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="Syncer.html">Syncer</a> represents the sync setup: Add to this
|
84
|
+
Sources via <a href="Syncer.html#M000017">add_source</a>, and use as a hub
|
85
|
+
for the <a href="Mappings.html">Mappings</a> between them.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
<a href="#M000017">add_source</a>
|
98
|
+
<a href="#M000019">changed_records</a>
|
99
|
+
<a href="#M000020">deleted_records</a>
|
100
|
+
<a href="#M000016">mappings</a>
|
101
|
+
<a href="#M000014">new</a>
|
102
|
+
<a href="#M000018">new_records</a>
|
103
|
+
<a href="#M000021">snapshot!</a>
|
104
|
+
<a href="#M000015">sources</a>
|
105
|
+
<a href="#M000025">sync!</a>
|
106
|
+
<a href="#M000024">sync_changed!</a>
|
107
|
+
<a href="#M000022">sync_deleted!</a>
|
108
|
+
<a href="#M000023">sync_new!</a>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
<!-- if includes -->
|
116
|
+
|
117
|
+
<div id="section">
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<div id="attribute-list">
|
124
|
+
<h3 class="section-bar">Attributes</h3>
|
125
|
+
|
126
|
+
<div class="name-list">
|
127
|
+
<table>
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">last_sync</td>
|
130
|
+
<td class="context-item-value"> [R] </td>
|
131
|
+
<td class="context-item-desc"></td>
|
132
|
+
</tr>
|
133
|
+
</table>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
<!-- if method_list -->
|
140
|
+
<div id="methods">
|
141
|
+
<h3 class="section-bar">Public Class methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000014" class="method-detail">
|
144
|
+
<a name="M000014"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="Syncer.src/M000014.html" target="Code" class="method-signature"
|
148
|
+
onclick="popupCode('Syncer.src/M000014.html');return false;">
|
149
|
+
<span class="method-name">new</span><span class="method-args">(last_sync)</span>
|
150
|
+
</a>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
<p>
|
155
|
+
Call with an optional Time object, which will be initiated into the <a
|
156
|
+
href="Syncer.html">Syncer</a> object as the last_sync time.
|
157
|
+
</p>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
162
|
+
|
163
|
+
<div id="method-M000017" class="method-detail">
|
164
|
+
<a name="M000017"></a>
|
165
|
+
|
166
|
+
<div class="method-heading">
|
167
|
+
<a href="Syncer.src/M000017.html" target="Code" class="method-signature"
|
168
|
+
onclick="popupCode('Syncer.src/M000017.html');return false;">
|
169
|
+
<span class="method-name">add_source</span><span class="method-args">(klass, identifier, finder_scope=nil, &block)</span>
|
170
|
+
</a>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div class="method-description">
|
174
|
+
<p>
|
175
|
+
Adds a <a href="Source.html">Source</a> to the <a
|
176
|
+
href="Syncer.html">Syncer</a>‘s list of <a
|
177
|
+
href="Syncer.html#M000015">sources</a>. If a block is supplied, it is sent
|
178
|
+
to <a href="Source.html#M000008">Source.new</a>, where it is understood to
|
179
|
+
be a block to be run on a newly-created record object of this source type.
|
180
|
+
</p>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
|
184
|
+
<div id="method-M000019" class="method-detail">
|
185
|
+
<a name="M000019"></a>
|
186
|
+
|
187
|
+
<div class="method-heading">
|
188
|
+
<a href="Syncer.src/M000019.html" target="Code" class="method-signature"
|
189
|
+
onclick="popupCode('Syncer.src/M000019.html');return false;">
|
190
|
+
<span class="method-name">changed_records</span><span class="method-args">()</span>
|
191
|
+
</a>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
<div class="method-description">
|
195
|
+
<p>
|
196
|
+
Lists the <a href="Syncer.html#M000019">changed_records</a> from all <a
|
197
|
+
href="Syncer.html#M000015">sources</a> put together. Generally only for
|
198
|
+
`poking around’ purposes, not used internally.
|
199
|
+
</p>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div id="method-M000020" class="method-detail">
|
204
|
+
<a name="M000020"></a>
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<a href="Syncer.src/M000020.html" target="Code" class="method-signature"
|
208
|
+
onclick="popupCode('Syncer.src/M000020.html');return false;">
|
209
|
+
<span class="method-name">deleted_records</span><span class="method-args">()</span>
|
210
|
+
</a>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
<p>
|
215
|
+
Lists the <a href="Syncer.html#M000020">deleted_records</a> from all <a
|
216
|
+
href="Syncer.html#M000015">sources</a> put together. Generally only for
|
217
|
+
`poking around’ purposes, not used internally.
|
218
|
+
</p>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
<div id="method-M000016" class="method-detail">
|
223
|
+
<a name="M000016"></a>
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
<a href="Syncer.src/M000016.html" target="Code" class="method-signature"
|
227
|
+
onclick="popupCode('Syncer.src/M000016.html');return false;">
|
228
|
+
<span class="method-name">mappings</span><span class="method-args">()</span>
|
229
|
+
</a>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
<div class="method-description">
|
233
|
+
<p>
|
234
|
+
Initializes and holds on to the <a href="Mappings.html">Mappings</a> for
|
235
|
+
this <a href="Syncer.html">Syncer</a> object.
|
236
|
+
</p>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div id="method-M000018" class="method-detail">
|
241
|
+
<a name="M000018"></a>
|
242
|
+
|
243
|
+
<div class="method-heading">
|
244
|
+
<a href="Syncer.src/M000018.html" target="Code" class="method-signature"
|
245
|
+
onclick="popupCode('Syncer.src/M000018.html');return false;">
|
246
|
+
<span class="method-name">new_records</span><span class="method-args">()</span>
|
247
|
+
</a>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="method-description">
|
251
|
+
<p>
|
252
|
+
Lists the <a href="Syncer.html#M000018">new_records</a> from all <a
|
253
|
+
href="Syncer.html#M000015">sources</a> put together. Generally only for
|
254
|
+
`poking around’ purposes, not used internally.
|
255
|
+
</p>
|
256
|
+
</div>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
<div id="method-M000021" class="method-detail">
|
260
|
+
<a name="M000021"></a>
|
261
|
+
|
262
|
+
<div class="method-heading">
|
263
|
+
<a href="Syncer.src/M000021.html" target="Code" class="method-signature"
|
264
|
+
onclick="popupCode('Syncer.src/M000021.html');return false;">
|
265
|
+
<span class="method-name">snapshot!</span><span class="method-args">()</span>
|
266
|
+
</a>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div class="method-description">
|
270
|
+
<p>
|
271
|
+
Takes a snapshot of every source, provided you‘ve set a block to each
|
272
|
+
source‘s <a href="Syncer.html#M000018">new_records</a>, <a
|
273
|
+
href="Syncer.html#M000019">changed_records</a>, and <a
|
274
|
+
href="Syncer.html#M000020">deleted_records</a> so it knows how to retrieve
|
275
|
+
them.
|
276
|
+
</p>
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
|
280
|
+
<div id="method-M000015" class="method-detail">
|
281
|
+
<a name="M000015"></a>
|
282
|
+
|
283
|
+
<div class="method-heading">
|
284
|
+
<a href="Syncer.src/M000015.html" target="Code" class="method-signature"
|
285
|
+
onclick="popupCode('Syncer.src/M000015.html');return false;">
|
286
|
+
<span class="method-name">sources</span><span class="method-args">()</span>
|
287
|
+
</a>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
<div class="method-description">
|
291
|
+
<p>
|
292
|
+
Keeps a list of <a href="Syncer.html#M000015">sources</a> in a simple Array
|
293
|
+
</p>
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
|
297
|
+
<div id="method-M000025" class="method-detail">
|
298
|
+
<a name="M000025"></a>
|
299
|
+
|
300
|
+
<div class="method-heading">
|
301
|
+
<a href="Syncer.src/M000025.html" target="Code" class="method-signature"
|
302
|
+
onclick="popupCode('Syncer.src/M000025.html');return false;">
|
303
|
+
<span class="method-name">sync!</span><span class="method-args">()</span>
|
304
|
+
</a>
|
305
|
+
</div>
|
306
|
+
|
307
|
+
<div class="method-description">
|
308
|
+
<p>
|
309
|
+
Synchronizes <a href="Syncer.html#M000020">deleted_records</a>, then <a
|
310
|
+
href="Syncer.html#M000018">new_records</a>, then <a
|
311
|
+
href="Syncer.html#M000019">changed_records</a>, simply by calling the <a
|
312
|
+
href="Syncer.html#M000025">sync!</a> method for each of them in turn. By
|
313
|
+
sync-ing <a href="Syncer.html#M000020">deleted_records</a> first and <a
|
314
|
+
href="Syncer.html#M000021">snapshot!</a>-ing the <a
|
315
|
+
href="Syncer.html#M000018">new_records</a> and <a
|
316
|
+
href="Syncer.html#M000019">changed_records</a> when their turn comes, we
|
317
|
+
can be sure those records deleted on one source won‘t show up in the
|
318
|
+
<a href="Syncer.html#M000018">new_records</a> or <a
|
319
|
+
href="Syncer.html#M000019">changed_records</a> on other <a
|
320
|
+
href="Syncer.html#M000015">sources</a>.
|
321
|
+
</p>
|
322
|
+
</div>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<div id="method-M000024" class="method-detail">
|
326
|
+
<a name="M000024"></a>
|
327
|
+
|
328
|
+
<div class="method-heading">
|
329
|
+
<a href="Syncer.src/M000024.html" target="Code" class="method-signature"
|
330
|
+
onclick="popupCode('Syncer.src/M000024.html');return false;">
|
331
|
+
<span class="method-name">sync_changed!</span><span class="method-args">()</span>
|
332
|
+
</a>
|
333
|
+
</div>
|
334
|
+
|
335
|
+
<div class="method-description">
|
336
|
+
<p>
|
337
|
+
Synchronizes only the <a href="Syncer.html#M000019">changed_records</a>,
|
338
|
+
from each source one at a time. With each source, first it takes a snapshot
|
339
|
+
of just the <a href="Syncer.html#M000019">changed_records</a> on just that
|
340
|
+
source, then it loops through the other <a
|
341
|
+
href="Syncer.html#M000015">sources</a> and updates them, by grabbing the
|
342
|
+
existing record, updating the attributes, and saving the record back.
|
343
|
+
</p>
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div id="method-M000022" class="method-detail">
|
348
|
+
<a name="M000022"></a>
|
349
|
+
|
350
|
+
<div class="method-heading">
|
351
|
+
<a href="Syncer.src/M000022.html" target="Code" class="method-signature"
|
352
|
+
onclick="popupCode('Syncer.src/M000022.html');return false;">
|
353
|
+
<span class="method-name">sync_deleted!</span><span class="method-args">()</span>
|
354
|
+
</a>
|
355
|
+
</div>
|
356
|
+
|
357
|
+
<div class="method-description">
|
358
|
+
<p>
|
359
|
+
Synchronizes only the <a href="Syncer.html#M000020">deleted_records</a>,
|
360
|
+
from each source one at a time. With each source, first it takes a snapshot
|
361
|
+
of just the <a href="Syncer.html#M000020">deleted_records</a> on just that
|
362
|
+
source, then it loops through the other <a
|
363
|
+
href="Syncer.html#M000015">sources</a> and deletes the record from each of
|
364
|
+
them, after checking to make sure it exists before attempting to delete it.
|
365
|
+
(This is rather inefficient, we should just ‘delete’ and if it
|
366
|
+
doesn‘t exist it doesn‘t matter.)
|
367
|
+
</p>
|
368
|
+
</div>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
<div id="method-M000023" class="method-detail">
|
372
|
+
<a name="M000023"></a>
|
373
|
+
|
374
|
+
<div class="method-heading">
|
375
|
+
<a href="Syncer.src/M000023.html" target="Code" class="method-signature"
|
376
|
+
onclick="popupCode('Syncer.src/M000023.html');return false;">
|
377
|
+
<span class="method-name">sync_new!</span><span class="method-args">()</span>
|
378
|
+
</a>
|
379
|
+
</div>
|
380
|
+
|
381
|
+
<div class="method-description">
|
382
|
+
<p>
|
383
|
+
Synchronizes only the <a href="Syncer.html#M000018">new_records</a>, from
|
384
|
+
each source one at a time. With each source, first it takes a snapshot of
|
385
|
+
just the <a href="Syncer.html#M000018">new_records</a> on just that source,
|
386
|
+
then it loops through the other <a href="Syncer.html#M000015">sources</a>
|
387
|
+
and creates the record on each of them. Since creating <a
|
388
|
+
href="Syncer.html#M000014">new</a> records sometimes requires saving the
|
389
|
+
associated-id back to the original record, the just-updated record is
|
390
|
+
morphed back to see if there are any attributes that should be updated on
|
391
|
+
the original record, and if so, it is also updated with the differences.
|
392
|
+
</p>
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
<div id="validator-badges">
|
404
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
405
|
+
</div>
|
406
|
+
|
407
|
+
</body>
|
408
|
+
</html>
|