autocode 0.9.0

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.
@@ -0,0 +1,158 @@
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: Autocreate</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">Autocreate</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/autocreate_rb.html">
59
+ lib/autocreate.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
+ Extending a module with <a href="Autocreate.html">Autocreate</a> allows you
78
+ to specify <a href="Autocreate.html#M000004">autocreate</a> rules for that
79
+ module.
80
+ </p>
81
+ <p>
82
+ <a href="Autocreate.html">Autocreate</a> allows you to automatically
83
+ created classes or modules based on a given exemplar at the time they are
84
+ referenced.
85
+ </p>
86
+ <p>
87
+ To use <a href="Autocreate.html">Autocreate</a>, mix it via <tt>extend</tt>
88
+ into the class or module within which you want to <a
89
+ href="Autocreate.html#M000004">autocreate</a> referenced constants.
90
+ </p>
91
+ <p>
92
+ See the README for an example of how to use <a
93
+ href="Autocreate.html">Autocreate</a>.
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="#M000004">autocreate</a>&nbsp;&nbsp;
106
+ </div>
107
+ </div>
108
+
109
+ </div>
110
+
111
+
112
+ <!-- if includes -->
113
+
114
+ <div id="section">
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <!-- if method_list -->
124
+ <div id="methods">
125
+ <h3 class="section-bar">Public Instance methods</h3>
126
+
127
+ <div id="method-M000004" class="method-detail">
128
+ <a name="M000004"></a>
129
+
130
+ <div class="method-heading">
131
+ <a href="Autocreate.src/M000004.html" target="Code" class="method-signature"
132
+ onclick="popupCode('Autocreate.src/M000004.html');return false;">
133
+ <span class="method-name">autocreate</span><span class="method-args">( key, exemplar, &amp;block )</span>
134
+ </a>
135
+ </div>
136
+
137
+ <div class="method-description">
138
+ <p>
139
+ Specifies that the constant specified by key should be autocreated using
140
+ the exemplar. If a block is given, the block is further used to initialize
141
+ the block once it has been cloned.
142
+ </p>
143
+ </div>
144
+ </div>
145
+
146
+
147
+ </div>
148
+
149
+
150
+ </div>
151
+
152
+
153
+ <div id="validator-badges">
154
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
155
+ </div>
156
+
157
+ </body>
158
+ </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>autocreate (Autocreate)</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/autocreate.rb, line 20</span>
14
+ 20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autocreate</span>( <span class="ruby-identifier">key</span>, <span class="ruby-identifier">exemplar</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span> )
15
+ 21: ( <span class="ruby-ivar">@autocreate</span> <span class="ruby-operator">||=</span> [] ) <span class="ruby-operator">&lt;&lt;</span> [ <span class="ruby-identifier">key</span>, <span class="ruby-identifier">exemplar</span>, <span class="ruby-identifier">block</span> ]
16
+ 22: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
17
+ 23: <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,206 @@
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: Autoload</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">Autoload</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/autoload_rb.html">
59
+ lib/autoload.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
+ <a href="Autoload.html">Autoload</a> allows you to specify which modules or
78
+ classes to automatically load when they are referenced. This is somewhat
79
+ more sophisticated than the <tt>autoinclude</tt> mechanism in the standard
80
+ library. For one thing, you can cause code to be reloaded by using <a
81
+ href="Reloadable.html">Reloadable</a> in conjunction with <a
82
+ href="Autoload.html">Autoload</a>. For another, you can provide a search
83
+ path using the <a href="Autoload.html#M000002">directories</a> method,
84
+ thereby allowing you to &quot;autoinclude&quot; entire <a
85
+ href="Autoload.html#M000002">directories</a> in one fell swoop.
86
+ </p>
87
+ <p>
88
+ To use <a href="Autoload.html">Autoload</a>, you must mix it into your
89
+ module or class via extend. That will provide the <a
90
+ href="Autoload.html#M000001">autoload</a> and <a
91
+ href="Autoload.html#M000002">directories</a> methods for you, as described
92
+ below.
93
+ </p>
94
+ <p>
95
+ A typical use case for <a href="Autoload.html">Autoload</a> looks like
96
+ this:
97
+ </p>
98
+ <pre>
99
+ require 'autocode'
100
+
101
+ module Models
102
+ extend Autoload; extend Reloadable
103
+ autoload true; directories :models
104
+ end
105
+ </pre>
106
+
107
+ </div>
108
+
109
+
110
+ </div>
111
+
112
+ <div id="method-list">
113
+ <h3 class="section-bar">Methods</h3>
114
+
115
+ <div class="name-list">
116
+ <a href="#M000001">autoload</a>&nbsp;&nbsp;
117
+ <a href="#M000003">autoload?</a>&nbsp;&nbsp;
118
+ <a href="#M000002">directories</a>&nbsp;&nbsp;
119
+ </div>
120
+ </div>
121
+
122
+ </div>
123
+
124
+
125
+ <!-- if includes -->
126
+
127
+ <div id="section">
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+ <!-- if method_list -->
137
+ <div id="methods">
138
+ <h3 class="section-bar">Public Instance methods</h3>
139
+
140
+ <div id="method-M000001" class="method-detail">
141
+ <a name="M000001"></a>
142
+
143
+ <div class="method-heading">
144
+ <a href="Autoload.src/M000001.html" target="Code" class="method-signature"
145
+ onclick="popupCode('Autoload.src/M000001.html');return false;">
146
+ <span class="method-name">autoload</span><span class="method-args">( *keys )</span>
147
+ </a>
148
+ </div>
149
+
150
+ <div class="method-description">
151
+ <p>
152
+ Specifies that you want to <a href="Autoload.html#M000001">autoload</a>
153
+ each of the constants referenced by keys. A key of true is basically a
154
+ wild-card, meaning &quot;load anything&quot;.
155
+ </p>
156
+ </div>
157
+ </div>
158
+
159
+ <div id="method-M000003" class="method-detail">
160
+ <a name="M000003"></a>
161
+
162
+ <div class="method-heading">
163
+ <a href="Autoload.src/M000003.html" target="Code" class="method-signature"
164
+ onclick="popupCode('Autoload.src/M000003.html');return false;">
165
+ <span class="method-name">autoload?</span><span class="method-args">( cname )</span>
166
+ </a>
167
+ </div>
168
+
169
+ <div class="method-description">
170
+ <p>
171
+ Is a given constant being autoloaded?
172
+ </p>
173
+ </div>
174
+ </div>
175
+
176
+ <div id="method-M000002" class="method-detail">
177
+ <a name="M000002"></a>
178
+
179
+ <div class="method-heading">
180
+ <a href="Autoload.src/M000002.html" target="Code" class="method-signature"
181
+ onclick="popupCode('Autoload.src/M000002.html');return false;">
182
+ <span class="method-name">directories</span><span class="method-args">( *dirs )</span>
183
+ </a>
184
+ </div>
185
+
186
+ <div class="method-description">
187
+ <p>
188
+ Provide a list of <a href="Autoload.html#M000002">directories</a> from
189
+ which a given constant might be loaded.
190
+ </p>
191
+ </div>
192
+ </div>
193
+
194
+
195
+ </div>
196
+
197
+
198
+ </div>
199
+
200
+
201
+ <div id="validator-badges">
202
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
203
+ </div>
204
+
205
+ </body>
206
+ </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>autoload (Autoload)</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/autoload.rb, line 26</span>
14
+ 26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autoload</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">keys</span> )
15
+ 27: ( <span class="ruby-ivar">@autoload</span> <span class="ruby-operator">||=</span> [] ).<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">keys</span>)
16
+ 28: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
17
+ 29: <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>directories (Autoload)</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/autoload.rb, line 32</span>
14
+ 32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directories</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">dirs</span> )
15
+ 33: ( <span class="ruby-ivar">@directories</span> <span class="ruby-operator">||=</span> [<span class="ruby-value str">'.'</span>] ).<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">dirs</span>)
16
+ 34: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
17
+ 35: <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </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>autoload? (Autoload)</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/autoload.rb, line 38</span>
14
+ 38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">autoload?</span>( <span class="ruby-identifier">cname</span> )
15
+ 39:
16
+ 40: <span class="ruby-identifier">cname</span> = <span class="ruby-identifier">cname</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>){ <span class="ruby-node">&quot;#{$1}_#{$2.downcase}&quot;</span>}
17
+ 41:
18
+ 42: <span class="ruby-comment cmt"># is this name autoloadable?</span>
19
+ 43: <span class="ruby-identifier">key</span> = ( <span class="ruby-ivar">@autoload</span> <span class="ruby-operator">||=</span> [] ).<span class="ruby-identifier">find</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
20
+ 44: <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">||</span> ( <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">cname</span> )
21
+ 45: <span class="ruby-keyword kw">end</span>
22
+ 46:
23
+ 47: <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>