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>[] (SimpleSync::Mappings)</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 161</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">src_tgt</span>)
|
15
|
+
<span class="ruby-identifier">source</span>, <span class="ruby-identifier">target</span> = <span class="ruby-identifier">src_tgt</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">src_tgt</span>.<span class="ruby-identifier">values</span>[<span class="ruby-value">0</span>]
|
16
|
+
<span class="ruby-identifier">mappings</span>[<span class="ruby-identifier">source</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'--'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">name</span>] <span class="ruby-operator">||</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>[]= (SimpleSync::Mappings)</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 167</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">src_tgt</span>, <span class="ruby-identifier">mapping</span>)
|
15
|
+
<span class="ruby-identifier">source</span>, <span class="ruby-identifier">target</span> = <span class="ruby-identifier">src_tgt</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">src_tgt</span>.<span class="ruby-identifier">values</span>[<span class="ruby-value">0</span>]
|
16
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-value str">"mapping must be a hash"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">mapping</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
17
|
+
<span class="ruby-identifier">mappings</span>[<span class="ruby-identifier">source</span>.<span class="ruby-identifier">name</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'--'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">mapping</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,188 @@
|
|
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>Module: SimpleSync::Record</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>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">SimpleSync::Record</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
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
The <a href="Record.html">Record</a> module is used to extend record
|
78
|
+
objects with a couple methods needed for sync-ing purposes.
|
79
|
+
</p>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<div id="method-list">
|
87
|
+
<h3 class="section-bar">Methods</h3>
|
88
|
+
|
89
|
+
<div class="name-list">
|
90
|
+
<a href="#M000002">extended</a>
|
91
|
+
<a href="#M000004">find_on</a>
|
92
|
+
<a href="#M000003">morph_to</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<div id="attribute-list">
|
108
|
+
<h3 class="section-bar">Attributes</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<table>
|
112
|
+
<tr class="top-aligned-row context-row">
|
113
|
+
<td class="context-item-name">source</td>
|
114
|
+
<td class="context-item-value"> [RW] </td>
|
115
|
+
<td class="context-item-desc"></td>
|
116
|
+
</tr>
|
117
|
+
</table>
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<!-- if method_list -->
|
124
|
+
<div id="methods">
|
125
|
+
<h3 class="section-bar">Public Class methods</h3>
|
126
|
+
|
127
|
+
<div id="method-M000002" class="method-detail">
|
128
|
+
<a name="M000002"></a>
|
129
|
+
|
130
|
+
<div class="method-heading">
|
131
|
+
<a href="Record.src/M000002.html" target="Code" class="method-signature"
|
132
|
+
onclick="popupCode('Record.src/M000002.html');return false;">
|
133
|
+
<span class="method-name">extended</span><span class="method-args">(base)</span>
|
134
|
+
</a>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class="method-description">
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
142
|
+
|
143
|
+
<div id="method-M000004" class="method-detail">
|
144
|
+
<a name="M000004"></a>
|
145
|
+
|
146
|
+
<div class="method-heading">
|
147
|
+
<a href="Record.src/M000004.html" target="Code" class="method-signature"
|
148
|
+
onclick="popupCode('Record.src/M000004.html');return false;">
|
149
|
+
<span class="method-name">find_on</span><span class="method-args">(target)</span>
|
150
|
+
</a>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
<p>
|
155
|
+
slave from master: {self => rec(external_id):map} slave from deleted:
|
156
|
+
{self => rec(external_id):map} master from slave: {external_id =>
|
157
|
+
rec(self):map} master from deleted: {external_id => rec(self):map}
|
158
|
+
</p>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div id="method-M000003" class="method-detail">
|
163
|
+
<a name="M000003"></a>
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<a href="Record.src/M000003.html" target="Code" class="method-signature"
|
167
|
+
onclick="popupCode('Record.src/M000003.html');return false;">
|
168
|
+
<span class="method-name">morph_to</span><span class="method-args">(target)</span>
|
169
|
+
</a>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
|
182
|
+
|
183
|
+
<div id="validator-badges">
|
184
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
</body>
|
188
|
+
</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>extended (SimpleSync::Record)</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 333</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">extended</span>(<span class="ruby-identifier">base</span>)
|
15
|
+
<span class="ruby-comment cmt"># Automatically adds 'identifier' method to the object if the object's class has an 'identifier'</span>
|
16
|
+
<span class="ruby-comment cmt"># method that mentions the name of the identifier attribute.</span>
|
17
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">identifier</span>
|
18
|
+
<span class="ruby-identifier">send</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">to_sym</span>)
|
19
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">base</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:identifier</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">base</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:identifier</span>)
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -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>morph_to (SimpleSync::Record)</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 341</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">morph_to</span><span class="ruby-identifier">morph_to</span>(<span class="ruby-identifier">target</span>)
|
15
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"can only morph by known mappings."</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">source</span>.<span class="ruby-identifier">can_map?</span>(<span class="ruby-identifier">target</span>)
|
16
|
+
<span class="ruby-identifier">new_attrs</span> = <span class="ruby-identifier">to_hash</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">identifier</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">identifier</span>).<span class="ruby-identifier">transform_keys_by_mapping</span>(<span class="ruby-identifier">source</span>.<span class="ruby-identifier">mapping_to</span>(<span class="ruby-identifier">target</span>))
|
17
|
+
<span class="ruby-identifier">rec</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">initialize_record</span>(<span class="ruby-identifier">target</span>.<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">new_attrs</span>))
|
18
|
+
<span class="ruby-identifier">rec</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">Record</span>
|
19
|
+
<span class="ruby-identifier">rec</span>.<span class="ruby-identifier">source</span> = <span class="ruby-identifier">target</span>
|
20
|
+
<span class="ruby-identifier">rec</span>
|
21
|
+
<span class="ruby-keyword kw">end</span></pre>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
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_on (SimpleSync::Record)</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 353</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_on</span>(<span class="ruby-identifier">target</span>)
|
15
|
+
<span class="ruby-identifier">ident_key</span> = <span class="ruby-identifier">target</span>.<span class="ruby-identifier">mapping_to</span>(<span class="ruby-identifier">source</span>)[<span class="ruby-identifier">target</span>.<span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">to_s</span>]
|
16
|
+
<span class="ruby-identifier">ident</span> = {<span class="ruby-identifier">target</span>.<span class="ruby-identifier">identifier</span>.<span class="ruby-identifier">to_s</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">ident_key</span>)}
|
17
|
+
<span class="ruby-comment cmt"># puts "Looking for record #{source.identifier.to_s} => #{identifier} as record #{ident_key} => #{ident.inspect}"</span>
|
18
|
+
<span class="ruby-identifier">found</span> = <span class="ruby-identifier">ident</span>.<span class="ruby-identifier">values</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">target</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">ident</span>)
|
19
|
+
<span class="ruby-comment cmt"># puts "Found: #{found.inspect}"</span>
|
20
|
+
<span class="ruby-identifier">found</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">Record</span>
|
21
|
+
<span class="ruby-identifier">found</span>.<span class="ruby-identifier">source</span> = <span class="ruby-identifier">target</span>
|
22
|
+
<span class="ruby-identifier">found</span>
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,235 @@
|
|
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::RecordSet</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::RecordSet</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="RecordSet.html">RecordSet</a> is a class used internally to store
|
84
|
+
collections of records, for new_records, changed_records, and
|
85
|
+
deleted_records. Though not documented here, you can use several of the
|
86
|
+
Array or Enumerable methods: [], <<, each, <a
|
87
|
+
href="RecordSet.html#M000032">clear</a>, length. RecordSets are created
|
88
|
+
automatically, so the new method isn‘t documented either. The biggest
|
89
|
+
thing it does is extend all record objects with the <a
|
90
|
+
href="Record.html">SimpleSync::Record</a> module, which gives them a few
|
91
|
+
essential methods. <a href="RecordSet.html">RecordSet</a> is also where all
|
92
|
+
the <a href="RecordSet.html#M000028">snapshot!</a> methods actually do
|
93
|
+
their work.
|
94
|
+
</p>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div id="method-list">
|
102
|
+
<h3 class="section-bar">Methods</h3>
|
103
|
+
|
104
|
+
<div class="name-list">
|
105
|
+
<a href="#M000032">clear</a>
|
106
|
+
<a href="#M000030">delete</a>
|
107
|
+
<a href="#M000031">find</a>
|
108
|
+
<a href="#M000029">set</a>
|
109
|
+
<a href="#M000028">snapshot!</a>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
<!-- if includes -->
|
117
|
+
|
118
|
+
<div id="section">
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<!-- if method_list -->
|
128
|
+
<div id="methods">
|
129
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
130
|
+
|
131
|
+
<div id="method-M000032" class="method-detail">
|
132
|
+
<a name="M000032"></a>
|
133
|
+
|
134
|
+
<div class="method-heading">
|
135
|
+
<a href="RecordSet.src/M000032.html" target="Code" class="method-signature"
|
136
|
+
onclick="popupCode('RecordSet.src/M000032.html');return false;">
|
137
|
+
<span class="method-name">clear</span><span class="method-args">()</span>
|
138
|
+
</a>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="method-description">
|
142
|
+
<p>
|
143
|
+
Simply clears the collection.
|
144
|
+
</p>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div id="method-M000030" class="method-detail">
|
149
|
+
<a name="M000030"></a>
|
150
|
+
|
151
|
+
<div class="method-heading">
|
152
|
+
<a href="RecordSet.src/M000030.html" target="Code" class="method-signature"
|
153
|
+
onclick="popupCode('RecordSet.src/M000030.html');return false;">
|
154
|
+
<span class="method-name">delete</span><span class="method-args">(record_or_identifier)</span>
|
155
|
+
</a>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div class="method-description">
|
159
|
+
<p>
|
160
|
+
Same as <a href="RecordSet.html#M000031">RecordSet#find</a> (below), but
|
161
|
+
removes the found record from this <a href="RecordSet.html">RecordSet</a>.
|
162
|
+
</p>
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div id="method-M000031" class="method-detail">
|
167
|
+
<a name="M000031"></a>
|
168
|
+
|
169
|
+
<div class="method-heading">
|
170
|
+
<a href="RecordSet.src/M000031.html" target="Code" class="method-signature"
|
171
|
+
onclick="popupCode('RecordSet.src/M000031.html');return false;">
|
172
|
+
<span class="method-name">find</span><span class="method-args">(record)</span>
|
173
|
+
</a>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div class="method-description">
|
177
|
+
<p>
|
178
|
+
Finds a in this <a href="RecordSet.html">RecordSet</a> given a record from
|
179
|
+
another <a href="RecordSet.html">RecordSet</a> on another source, or
|
180
|
+
returns nil on not found.
|
181
|
+
</p>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div id="method-M000029" class="method-detail">
|
186
|
+
<a name="M000029"></a>
|
187
|
+
|
188
|
+
<div class="method-heading">
|
189
|
+
<a href="RecordSet.src/M000029.html" target="Code" class="method-signature"
|
190
|
+
onclick="popupCode('RecordSet.src/M000029.html');return false;">
|
191
|
+
<span class="method-name">set</span><span class="method-args">()</span>
|
192
|
+
</a>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
<p>
|
197
|
+
Returns a simple Array of the collection - provided public mostly for
|
198
|
+
debugging purposes. Typically you won‘t use this method publicly in
|
199
|
+
production code.
|
200
|
+
</p>
|
201
|
+
</div>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div id="method-M000028" class="method-detail">
|
205
|
+
<a name="M000028"></a>
|
206
|
+
|
207
|
+
<div class="method-heading">
|
208
|
+
<a href="RecordSet.src/M000028.html" target="Code" class="method-signature"
|
209
|
+
onclick="popupCode('RecordSet.src/M000028.html');return false;">
|
210
|
+
<span class="method-name">snapshot!</span><span class="method-args">()</span>
|
211
|
+
</a>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
<div class="method-description">
|
215
|
+
<p>
|
216
|
+
Takes a snapshot of whatever type of records this <a
|
217
|
+
href="RecordSet.html">RecordSet</a> holds, by using the block assigned to
|
218
|
+
the <a href="RecordSet.html">RecordSet</a>.
|
219
|
+
</p>
|
220
|
+
</div>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
|
227
|
+
</div>
|
228
|
+
|
229
|
+
|
230
|
+
<div id="validator-badges">
|
231
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
</body>
|
235
|
+
</html>
|