simply_versioned 0.9.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,178 @@
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: SoftwareHeretics::ActiveRecord::SimplyVersioned::InstanceMethods</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">SoftwareHeretics::ActiveRecord::SimplyVersioned::InstanceMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/simply_versioned_rb.html">
59
+ lib/simply_versioned.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
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000009">revert_to_version</a>&nbsp;&nbsp;
84
+ <a href="#M000010">simply_versioned_create_version</a>&nbsp;&nbsp;
85
+ </div>
86
+ </div>
87
+
88
+ </div>
89
+
90
+
91
+ <!-- if includes -->
92
+
93
+ <div id="section">
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <!-- if method_list -->
103
+ <div id="methods">
104
+ <h3 class="section-bar">Public Instance methods</h3>
105
+
106
+ <div id="method-M000009" class="method-detail">
107
+ <a name="M000009"></a>
108
+
109
+ <div class="method-heading">
110
+ <a href="#M000009" class="method-signature">
111
+ <span class="method-name">revert_to_version</span><span class="method-args">( version )</span>
112
+ </a>
113
+ </div>
114
+
115
+ <div class="method-description">
116
+ <p>
117
+ Revert this model instance to the attributes it had at the specified
118
+ version number.
119
+ </p>
120
+ <p><a class="source-toggle" href="#"
121
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
122
+ <div class="method-source-code" id="M000009-source">
123
+ <pre>
124
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 41</span>
125
+ 41: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert_to_version</span>( <span class="ruby-identifier">version</span> )
126
+ 42: <span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">version</span>.<span class="ruby-identifier">kind_of?</span>( <span class="ruby-constant">Version</span> )
127
+ 43: <span class="ruby-identifier">version</span>
128
+ 44: <span class="ruby-keyword kw">else</span>
129
+ 45: <span class="ruby-identifier">version</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">versions</span>.<span class="ruby-identifier">find</span>( <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-identifier">:number</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Integer</span>( <span class="ruby-identifier">version</span> ) } )
130
+ 46: <span class="ruby-keyword kw">end</span>
131
+ 47: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">update_attributes</span>( <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load</span>( <span class="ruby-identifier">version</span>.<span class="ruby-identifier">yaml</span> ) )
132
+ 48: <span class="ruby-keyword kw">end</span>
133
+ </pre>
134
+ </div>
135
+ </div>
136
+ </div>
137
+
138
+ <h3 class="section-bar">Protected Instance methods</h3>
139
+
140
+ <div id="method-M000010" class="method-detail">
141
+ <a name="M000010"></a>
142
+
143
+ <div class="method-heading">
144
+ <a href="#M000010" class="method-signature">
145
+ <span class="method-name">simply_versioned_create_version</span><span class="method-args">()</span>
146
+ </a>
147
+ </div>
148
+
149
+ <div class="method-description">
150
+ <p><a class="source-toggle" href="#"
151
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
152
+ <div class="method-source-code" id="M000010-source">
153
+ <pre>
154
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 52</span>
155
+ 52: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">simply_versioned_create_version</span>
156
+ 53: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">versions</span>.<span class="ruby-identifier">create</span>( <span class="ruby-identifier">:yaml</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">to_yaml</span> )
157
+ 54: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">versions</span>.<span class="ruby-identifier">clean</span>( <span class="ruby-identifier">simply_versioned_keep_limit</span> )
158
+ 55: <span class="ruby-keyword kw">end</span>
159
+ 56: <span class="ruby-keyword kw">true</span>
160
+ 57: <span class="ruby-keyword kw">end</span>
161
+ </pre>
162
+ </div>
163
+ </div>
164
+ </div>
165
+
166
+
167
+ </div>
168
+
169
+
170
+ </div>
171
+
172
+
173
+ <div id="validator-badges">
174
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
175
+ </div>
176
+
177
+ </body>
178
+ </html>
@@ -0,0 +1,286 @@
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: SoftwareHeretics::ActiveRecord::SimplyVersioned::VersionsProxyMethods</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">SoftwareHeretics::ActiveRecord::SimplyVersioned::VersionsProxyMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/simply_versioned_rb.html">
59
+ lib/simply_versioned.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
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000005">clean</a>&nbsp;&nbsp;
84
+ <a href="#M000004">current</a>&nbsp;&nbsp;
85
+ <a href="#M000003">first</a>&nbsp;&nbsp;
86
+ <a href="#M000002">get</a>&nbsp;&nbsp;
87
+ <a href="#M000006">next</a>&nbsp;&nbsp;
88
+ <a href="#M000007">prev</a>&nbsp;&nbsp;
89
+ </div>
90
+ </div>
91
+
92
+ </div>
93
+
94
+
95
+ <!-- if includes -->
96
+
97
+ <div id="section">
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ <!-- if method_list -->
107
+ <div id="methods">
108
+ <h3 class="section-bar">Public Instance methods</h3>
109
+
110
+ <div id="method-M000005" class="method-detail">
111
+ <a name="M000005"></a>
112
+
113
+ <div class="method-heading">
114
+ <a href="#M000005" class="method-signature">
115
+ <span class="method-name">clean</span><span class="method-args">( versions_to_keep )</span>
116
+ </a>
117
+ </div>
118
+
119
+ <div class="method-description">
120
+ <p>
121
+ If the model instance has more versions than the limit specified, delete
122
+ all excess older versions.
123
+ </p>
124
+ <p><a class="source-toggle" href="#"
125
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
126
+ <div class="method-source-code" id="M000005-source">
127
+ <pre>
128
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 79</span>
129
+ 79: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clean</span>( <span class="ruby-identifier">versions_to_keep</span> )
130
+ 80: <span class="ruby-identifier">find</span>( <span class="ruby-identifier">:all</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [ <span class="ruby-value str">'number &lt;= ?'</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">maximum</span>( <span class="ruby-identifier">:number</span> ) <span class="ruby-operator">-</span> <span class="ruby-identifier">versions_to_keep</span> ] ).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">version</span><span class="ruby-operator">|</span>
131
+ 81: <span class="ruby-identifier">version</span>.<span class="ruby-identifier">destroy</span>
132
+ 82: <span class="ruby-keyword kw">end</span>
133
+ 83: <span class="ruby-keyword kw">end</span>
134
+ </pre>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+ <div id="method-M000004" class="method-detail">
140
+ <a name="M000004"></a>
141
+
142
+ <div class="method-heading">
143
+ <a href="#M000004" class="method-signature">
144
+ <span class="method-name">current</span><span class="method-args">()</span>
145
+ </a>
146
+ </div>
147
+
148
+ <div class="method-description">
149
+ <p>
150
+ Get the <a href="VersionsProxyMethods.html#M000004">current</a> Version
151
+ corresponding to this model.
152
+ </p>
153
+ <p><a class="source-toggle" href="#"
154
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
155
+ <div class="method-source-code" id="M000004-source">
156
+ <pre>
157
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 74</span>
158
+ 74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current</span>
159
+ 75: <span class="ruby-identifier">find</span>( <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'number DESC'</span> )
160
+ 76: <span class="ruby-keyword kw">end</span>
161
+ </pre>
162
+ </div>
163
+ </div>
164
+ </div>
165
+
166
+ <div id="method-M000003" class="method-detail">
167
+ <a name="M000003"></a>
168
+
169
+ <div class="method-heading">
170
+ <a href="#M000003" class="method-signature">
171
+ <span class="method-name">first</span><span class="method-args">()</span>
172
+ </a>
173
+ </div>
174
+
175
+ <div class="method-description">
176
+ <p>
177
+ Get the <a href="VersionsProxyMethods.html#M000003">first</a> Version
178
+ corresponding to this model.
179
+ </p>
180
+ <p><a class="source-toggle" href="#"
181
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
182
+ <div class="method-source-code" id="M000003-source">
183
+ <pre>
184
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 69</span>
185
+ 69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span>
186
+ 70: <span class="ruby-identifier">find</span>( <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'number ASC'</span> )
187
+ 71: <span class="ruby-keyword kw">end</span>
188
+ </pre>
189
+ </div>
190
+ </div>
191
+ </div>
192
+
193
+ <div id="method-M000002" class="method-detail">
194
+ <a name="M000002"></a>
195
+
196
+ <div class="method-heading">
197
+ <a href="#M000002" class="method-signature">
198
+ <span class="method-name">get</span><span class="method-args">( number )</span>
199
+ </a>
200
+ </div>
201
+
202
+ <div class="method-description">
203
+ <p>
204
+ Get the Version instance corresponding to this models for the specified
205
+ version number.
206
+ </p>
207
+ <p><a class="source-toggle" href="#"
208
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000002-source">
210
+ <pre>
211
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 64</span>
212
+ 64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>( <span class="ruby-identifier">number</span> )
213
+ 65: <span class="ruby-identifier">find_by_number</span>( <span class="ruby-identifier">number</span> )
214
+ 66: <span class="ruby-keyword kw">end</span>
215
+ </pre>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <div id="method-M000006" class="method-detail">
221
+ <a name="M000006"></a>
222
+
223
+ <div class="method-heading">
224
+ <a href="#M000006" class="method-signature">
225
+ <span class="method-name">next</span><span class="method-args">( number )</span>
226
+ </a>
227
+ </div>
228
+
229
+ <div class="method-description">
230
+ <p>
231
+ Return the Version for this model with the <a
232
+ href="VersionsProxyMethods.html#M000006">next</a> higher version
233
+ </p>
234
+ <p><a class="source-toggle" href="#"
235
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
236
+ <div class="method-source-code" id="M000006-source">
237
+ <pre>
238
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 86</span>
239
+ 86: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">next</span>( <span class="ruby-identifier">number</span> )
240
+ 87: <span class="ruby-identifier">find</span>( <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'number ASC'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [ <span class="ruby-value str">&quot;number &gt; ?&quot;</span>, <span class="ruby-identifier">number</span> ] )
241
+ 88: <span class="ruby-keyword kw">end</span>
242
+ </pre>
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div id="method-M000007" class="method-detail">
248
+ <a name="M000007"></a>
249
+
250
+ <div class="method-heading">
251
+ <a href="#M000007" class="method-signature">
252
+ <span class="method-name">prev</span><span class="method-args">( number )</span>
253
+ </a>
254
+ </div>
255
+
256
+ <div class="method-description">
257
+ <p>
258
+ Return the Version for this model with the <a
259
+ href="VersionsProxyMethods.html#M000006">next</a> lower version
260
+ </p>
261
+ <p><a class="source-toggle" href="#"
262
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
263
+ <div class="method-source-code" id="M000007-source">
264
+ <pre>
265
+ <span class="ruby-comment cmt"># File lib/simply_versioned.rb, line 91</span>
266
+ 91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prev</span>( <span class="ruby-identifier">number</span> )
267
+ 92: <span class="ruby-identifier">find</span>( <span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'number DESC'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</span> [ <span class="ruby-value str">&quot;number &lt; ?&quot;</span>, <span class="ruby-identifier">number</span> ] )
268
+ 93: <span class="ruby-keyword kw">end</span>
269
+ </pre>
270
+ </div>
271
+ </div>
272
+ </div>
273
+
274
+
275
+ </div>
276
+
277
+
278
+ </div>
279
+
280
+
281
+ <div id="validator-badges">
282
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
283
+ </div>
284
+
285
+ </body>
286
+ </html>