delynn-uuid_fu 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README ADDED
@@ -0,0 +1,3 @@
1
+ README
2
+ ========================================================================
3
+ uuid_fu was developed by: delynn@gmail.com
@@ -0,0 +1,151 @@
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: UuidFu</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">UuidFu</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/uuid_fu/schema_statements_rb.html">
59
+ lib/uuid_fu/schema_statements.rb
60
+ </a>
61
+ <br />
62
+ <a href="../files/lib/uuid_fu/uuid_fu_rb.html">
63
+ lib/uuid_fu/uuid_fu.rb
64
+ </a>
65
+ <br />
66
+ </td>
67
+ </tr>
68
+
69
+ </table>
70
+ </div>
71
+ <!-- banner header -->
72
+
73
+ <div id="bodyContent">
74
+
75
+
76
+
77
+ <div id="contextContent">
78
+
79
+
80
+
81
+ </div>
82
+
83
+ <div id="method-list">
84
+ <h3 class="section-bar">Methods</h3>
85
+
86
+ <div class="name-list">
87
+ <a href="#M000001">included</a>&nbsp;&nbsp;
88
+ </div>
89
+ </div>
90
+
91
+ </div>
92
+
93
+
94
+ <!-- if includes -->
95
+
96
+ <div id="section">
97
+
98
+ <div id="class-list">
99
+ <h3 class="section-bar">Classes and Modules</h3>
100
+
101
+ Module <a href="UuidFu/ClassMethods.html" class="link">UuidFu::ClassMethods</a><br />
102
+ Module <a href="UuidFu/SchemaStatements.html" class="link">UuidFu::SchemaStatements</a><br />
103
+
104
+ </div>
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <!-- if method_list -->
113
+ <div id="methods">
114
+ <h3 class="section-bar">Public Class methods</h3>
115
+
116
+ <div id="method-M000001" class="method-detail">
117
+ <a name="M000001"></a>
118
+
119
+ <div class="method-heading">
120
+ <a href="#M000001" class="method-signature">
121
+ <span class="method-name">included</span><span class="method-args">(base)</span>
122
+ </a>
123
+ </div>
124
+
125
+ <div class="method-description">
126
+ <p><a class="source-toggle" href="#"
127
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
128
+ <div class="method-source-code" id="M000001-source">
129
+ <pre>
130
+ <span class="ruby-comment cmt"># File lib/uuid_fu/uuid_fu.rb, line 5</span>
131
+ 5: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
132
+ 6: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">ClassMethods</span>)
133
+ 7: <span class="ruby-keyword kw">end</span>
134
+ </pre>
135
+ </div>
136
+ </div>
137
+ </div>
138
+
139
+
140
+ </div>
141
+
142
+
143
+ </div>
144
+
145
+
146
+ <div id="validator-badges">
147
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
148
+ </div>
149
+
150
+ </body>
151
+ </html>
@@ -0,0 +1,222 @@
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: UuidFu::ClassMethods</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">UuidFu::ClassMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/uuid_fu/uuid_fu_rb.html">
59
+ lib/uuid_fu/uuid_fu.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="#M000003">before_create_with_uuid</a>&nbsp;&nbsp;
84
+ <a href="#M000002">uniquely_identified_by</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-M000003" class="method-detail">
107
+ <a name="M000003"></a>
108
+
109
+ <div class="method-heading">
110
+ <a href="#M000003" class="method-signature">
111
+ <span class="method-name">before_create_with_uuid</span><span class="method-args">()</span>
112
+ </a>
113
+ </div>
114
+
115
+ <div class="method-description">
116
+ <p><a class="source-toggle" href="#"
117
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
118
+ <div class="method-source-code" id="M000003-source">
119
+ <pre>
120
+ <span class="ruby-comment cmt"># File lib/uuid_fu/uuid_fu.rb, line 50</span>
121
+ 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_create_with_uuid</span>
122
+ 51: <span class="ruby-identifier">before_create_without_uuid</span>
123
+ 52: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">uniquely_identified_columns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span>, <span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
124
+ 53: <span class="ruby-identifier">format</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format_for_uniquely_identified_columns</span>
125
+ 54: <span class="ruby-identifier">uuid</span> = <span class="ruby-constant">UUID</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">format</span>)
126
+ 55: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{column}=&quot;</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">uuid</span>)
127
+ 56: <span class="ruby-keyword kw">end</span>
128
+ 57: <span class="ruby-keyword kw">end</span>
129
+ </pre>
130
+ </div>
131
+ </div>
132
+ </div>
133
+
134
+ <div id="method-M000002" class="method-detail">
135
+ <a name="M000002"></a>
136
+
137
+ <div class="method-heading">
138
+ <a href="#M000002" class="method-signature">
139
+ <span class="method-name">uniquely_identified_by</span><span class="method-args">(*args)</span>
140
+ </a>
141
+ </div>
142
+
143
+ <div class="method-description">
144
+ <p>
145
+ Identify which columns should use a Universally Unique Identifier, along
146
+ with the UUID format. Available formats are <tt>:default</tt>,
147
+ <tt>:compressed</tt>, and <tt>:urn</tt>. The plug-in actually defaults to
148
+ using the <tt>:compressed</tt> format as the default since it doesn&#8216;t
149
+ include dashes.
150
+ </p>
151
+ <h3>Examples</h3>
152
+ <pre>
153
+ # A new User instance will have the &lt;tt&gt;id&lt;/tt&gt; attribute set to a UUID with the &lt;tt&gt;:compressed&lt;/tt&gt;
154
+ # format.
155
+ class User &lt; ActiveRecord::Base
156
+ uniquely_identified_by(:id)
157
+ end
158
+
159
+ # A new User instance will have all the attributes set to a UUID with the &lt;tt&gt;:default&lt;/tt&gt;
160
+ # format.
161
+ class User &lt; ActiveRecord::Base
162
+ uniquely_identified_by(:id, :other, :uuid_format =&gt; :default)
163
+ end
164
+
165
+ # A new User instance will have the &lt;tt&gt;:id&lt;/tt&gt; attribute set to a UUID with the &lt;tt&gt;:default&lt;/tt&gt;
166
+ # format, the &lt;tt&gt;:other&lt;/tt&gt; attribute will be set to a UUID with the &lt;tt&gt;:urn&lt;/tt&gt; format, and
167
+ # the &lt;tt&gt;:last&lt;/tt&gt; attribute will be set to a UUID with the &lt;tt&gt;:compressed&lt;/tt&gt; format.
168
+ class User &lt; ActiveRecord::Base
169
+ uniquely_identified_by(:id =&gt; :default, :other =&gt; :urn, :last =&gt; :compressed)
170
+ end
171
+ </pre>
172
+ <p><a class="source-toggle" href="#"
173
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
174
+ <div class="method-source-code" id="M000002-source">
175
+ <pre>
176
+ <span class="ruby-comment cmt"># File lib/uuid_fu/uuid_fu.rb, line 34</span>
177
+ 34: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uniquely_identified_by</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
178
+ 35: <span class="ruby-identifier">cattr_accessor</span> <span class="ruby-identifier">:uniquely_identified_columns</span>
179
+ 36: <span class="ruby-identifier">cattr_accessor</span> <span class="ruby-identifier">:format_for_uniquely_identified_columns</span>
180
+ 37:
181
+ 38: <span class="ruby-identifier">columns_and_formats</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>
182
+ 39: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">columns_and_formats</span>.<span class="ruby-identifier">empty?</span>
183
+ 40: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format_for_uniquely_identified_columns</span> = <span class="ruby-identifier">:compact</span>
184
+ 41: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">uniquely_identified_columns</span> = [<span class="ruby-identifier">args</span>].<span class="ruby-identifier">flatten</span>
185
+ 42: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">columns_and_formats</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">:uuid_format</span>)
186
+ 43: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format_for_uniquely_identified_columns</span> = <span class="ruby-identifier">columns_and_formats</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:uuid_format</span>)
187
+ 44: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">uniquely_identified_columns</span> = [<span class="ruby-identifier">args</span>].<span class="ruby-identifier">flatten</span>
188
+ 45: <span class="ruby-keyword kw">else</span>
189
+ 46: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">uniquely_identified_columns</span> = <span class="ruby-identifier">columns_and_formats</span>
190
+ 47: <span class="ruby-keyword kw">end</span>
191
+ 48:
192
+ 49: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class_eval</span> <span class="ruby-keyword kw">do</span>
193
+ 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">before_create_with_uuid</span>
194
+ 51: <span class="ruby-identifier">before_create_without_uuid</span>
195
+ 52: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">uniquely_identified_columns</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">column</span>, <span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
196
+ 53: <span class="ruby-identifier">format</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">format_for_uniquely_identified_columns</span>
197
+ 54: <span class="ruby-identifier">uuid</span> = <span class="ruby-constant">UUID</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-identifier">format</span>)
198
+ 55: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{column}=&quot;</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">uuid</span>)
199
+ 56: <span class="ruby-keyword kw">end</span>
200
+ 57: <span class="ruby-keyword kw">end</span>
201
+ 58:
202
+ 59: <span class="ruby-identifier">alias_method_chain</span> <span class="ruby-identifier">:before_create</span>, <span class="ruby-identifier">:uuid</span>
203
+ 60: <span class="ruby-keyword kw">end</span>
204
+ 61: <span class="ruby-keyword kw">end</span>
205
+ </pre>
206
+ </div>
207
+ </div>
208
+ </div>
209
+
210
+
211
+ </div>
212
+
213
+
214
+ </div>
215
+
216
+
217
+ <div id="validator-badges">
218
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
219
+ </div>
220
+
221
+ </body>
222
+ </html>
@@ -0,0 +1,147 @@
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: UuidFu::SchemaStatements</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">UuidFu::SchemaStatements</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/uuid_fu/schema_statements_rb.html">
59
+ lib/uuid_fu/schema_statements.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="#M000004">included</a>&nbsp;&nbsp;
84
+ </div>
85
+ </div>
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+ <div id="class-list">
95
+ <h3 class="section-bar">Classes and Modules</h3>
96
+
97
+ Module <a href="SchemaStatements/InstanceMethods.html" class="link">UuidFu::SchemaStatements::InstanceMethods</a><br />
98
+
99
+ </div>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ <!-- if method_list -->
108
+ <div id="methods">
109
+ <h3 class="section-bar">Public Class methods</h3>
110
+
111
+ <div id="method-M000004" class="method-detail">
112
+ <a name="M000004"></a>
113
+
114
+ <div class="method-heading">
115
+ <a href="#M000004" class="method-signature">
116
+ <span class="method-name">included</span><span class="method-args">(base)</span>
117
+ </a>
118
+ </div>
119
+
120
+ <div class="method-description">
121
+ <p><a class="source-toggle" href="#"
122
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
123
+ <div class="method-source-code" id="M000004-source">
124
+ <pre>
125
+ <span class="ruby-comment cmt"># File lib/uuid_fu/schema_statements.rb, line 3</span>
126
+ 3: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
127
+ 4: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-constant">InstanceMethods</span>)
128
+ 5: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">alias_method_chain</span>(<span class="ruby-identifier">:type_to_sql</span>, <span class="ruby-identifier">:uuid</span>)
129
+ 6: <span class="ruby-keyword kw">end</span>
130
+ </pre>
131
+ </div>
132
+ </div>
133
+ </div>
134
+
135
+
136
+ </div>
137
+
138
+
139
+ </div>
140
+
141
+
142
+ <div id="validator-badges">
143
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
144
+ </div>
145
+
146
+ </body>
147
+ </html>