autocode 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,173 @@
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: Reloadable</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">Reloadable</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/reloadable_rb.html">
59
+ lib/reloadable.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="Reloadable.html">Reloadable</a> simply makes it possible for a
78
+ module&#8216;s code to be reloaded. <b>Important</b>: Only code loaded via
79
+ <a href="Autoload.html">Autoload</a> or <a
80
+ href="Autocreate.html">Autocreate</a> will be reloaded. Also, the module
81
+ itself is not reloaded, only the modules and classes within it that were
82
+ loaded via <b>Autocode</b>.
83
+ </p>
84
+ <p>
85
+ To use <a href="Reloadable.html">Reloadable</a>, simply extend a given
86
+ module with <a href="Reloadable.html">Reloadable</a>. This will add two
87
+ methods to the module: <a href="Reloadable.html#M000005">reloadable</a> and
88
+ <a href="Reloadable.html#M000006">reload</a>. These are described below.
89
+ </p>
90
+
91
+ </div>
92
+
93
+
94
+ </div>
95
+
96
+ <div id="method-list">
97
+ <h3 class="section-bar">Methods</h3>
98
+
99
+ <div class="name-list">
100
+ <a href="#M000006">reload</a>&nbsp;&nbsp;
101
+ <a href="#M000005">reloadable</a>&nbsp;&nbsp;
102
+ </div>
103
+ </div>
104
+
105
+ </div>
106
+
107
+
108
+ <!-- if includes -->
109
+
110
+ <div id="section">
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ <!-- if method_list -->
120
+ <div id="methods">
121
+ <h3 class="section-bar">Public Instance methods</h3>
122
+
123
+ <div id="method-M000006" class="method-detail">
124
+ <a name="M000006"></a>
125
+
126
+ <div class="method-heading">
127
+ <a href="Reloadable.src/M000006.html" target="Code" class="method-signature"
128
+ onclick="popupCode('Reloadable.src/M000006.html');return false;">
129
+ <span class="method-name">reload</span><span class="method-args">()</span>
130
+ </a>
131
+ </div>
132
+
133
+ <div class="method-description">
134
+ <p>
135
+ Reloads all the constants that were loaded via <b>Autocode</b>.
136
+ Technically, all <a href="Reloadable.html#M000006">reload</a> is doing is
137
+ undefining them (by calling <tt>remove_const</tt> on each in turn); they
138
+ won&#8216;t get reloaded until they are referenced.
139
+ </p>
140
+ </div>
141
+ </div>
142
+
143
+ <div id="method-M000005" class="method-detail">
144
+ <a name="M000005"></a>
145
+
146
+ <div class="method-heading">
147
+ <a href="Reloadable.src/M000005.html" target="Code" class="method-signature"
148
+ onclick="popupCode('Reloadable.src/M000005.html');return false;">
149
+ <span class="method-name">reloadable</span><span class="method-args">( *names )</span>
150
+ </a>
151
+ </div>
152
+
153
+ <div class="method-description">
154
+ <p>
155
+ Returns the list of constants that would be reloaded upon a call to <a
156
+ href="Reloadable.html#M000006">reload</a>.
157
+ </p>
158
+ </div>
159
+ </div>
160
+
161
+
162
+ </div>
163
+
164
+
165
+ </div>
166
+
167
+
168
+ <div id="validator-badges">
169
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
170
+ </div>
171
+
172
+ </body>
173
+ </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>reloadable (Reloadable)</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/reloadable.rb, line 15</span>
14
+ 15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reloadable</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">names</span> )
15
+ 16: ( <span class="ruby-ivar">@reloadable</span> <span class="ruby-operator">||=</span> [] ).<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">names</span>)
16
+ 17: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
17
+ 18: <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>reload (Reloadable)</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/reloadable.rb, line 21</span>
14
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>
15
+ 22: ( <span class="ruby-ivar">@reloadable</span> <span class="ruby-operator">||=</span>[] ).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">remove_const</span>( <span class="ruby-identifier">name</span> ) }
16
+ 23: <span class="ruby-ivar">@reloadable</span> = []; <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
17
+ 24: <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1 @@
1
+ Fri, 04 Jan 2008 21:38:39 -0800
@@ -0,0 +1,200 @@
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>File: README</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="fileHeader">
50
+ <h1>README</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Jan 04 21:18:31 -0800 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>Introducing Autocode</h1>
73
+ <p>
74
+ Autocode makes it relatively easy to automatically (re)load or even
75
+ generate classes and modules on the fly. You can use it like this:
76
+ </p>
77
+ <pre>
78
+ require 'autocode'
79
+
80
+ module Application
81
+ extend Autoload
82
+ autoload true
83
+ directories :configurations, :models, :views, :controllers
84
+ end
85
+ </pre>
86
+ <p>
87
+ This will attempt to load code dynamically from the given directories,
88
+ using the module name to determine which directory to look in. Thus,
89
+ <tt>Application::CustomerModel</tt> could load the file
90
+ <tt>models/customer_model.rb</tt>.
91
+ </p>
92
+ <h2>Reloading Code</h2>
93
+ <p>
94
+ To make code reloadable (very useful when debugging running processes),
95
+ simply extend <a href="../classes/Reloadable.html">Reloadable</a>. Thus,
96
+ our above example would become:
97
+ </p>
98
+ <pre>
99
+ require 'autocode'
100
+
101
+ module Application
102
+ extend Autoload; extend Reloadable
103
+ autoload true
104
+ directories :configurations, :models, :views, :controllers
105
+ end
106
+ </pre>
107
+ <p>
108
+ Then, later on, we can simply call <tt>Application.reload</tt> to reload
109
+ all the code that was loaded via <b>Autocode</b>. <b>Important</b>: Only
110
+ code loaded via <b>Autocode</b> (<a
111
+ href="../classes/Autoload.html">Autoload</a> or <a
112
+ href="../classes/Autocreate.html">Autocreate</a>) will be reloaded.
113
+ </p>
114
+ <h2>Autocreation</h2>
115
+ <p>
116
+ Sometimes it&#8216;s useful to generate defaults for classes or modules
117
+ that don&#8216;t exist. This can be particularly powerful when used in
118
+ combination with autoloading.
119
+ </p>
120
+ <pre>
121
+ require 'autocode'
122
+
123
+ module Application
124
+ extend Autoload; extend Reloadable
125
+ [ [ :Configurations, :configurations ],
126
+ [ :Models, :models ],
127
+ [ :Views, :views ],
128
+ [ :Controllers, :controllers ] ].each |mod_name, dir_name| do
129
+ autocreate mod_name, Module.new do
130
+ extend Autoload
131
+ autoload true
132
+ directories dir_name
133
+ end
134
+ end
135
+ end
136
+ </pre>
137
+ <p>
138
+ This will autocreate the modules Configurations, Models, Views, and
139
+ Controllers within the Application module, as they are referenced, based on
140
+ the exemplar Module configured to autoload code from the configurations,
141
+ models, views, and controllers directories.
142
+ </p>
143
+ <p>
144
+ For example, referencing <tt>Application::Models::Customer</tt> will cause
145
+ the file <tt>models/customer.rb</tt> to be loaded.
146
+ </p>
147
+ <h2>Other Uses</h2>
148
+ <p>
149
+ Autoloading and autocreation, along with reloading, can be used to provide
150
+ sophisticated rules for loading and even generating modules and classes
151
+ within a given module. These capabilities are increasingly found within
152
+ frameworks like Rails and Camping, but <b>Autocode</b> makes it possible to
153
+ mixin these capabilities into any situation and precisely control how they
154
+ are applied.
155
+ </p>
156
+ <h2>Support</h2>
157
+ <p>
158
+ If you have questions or comments, please go to the <b>Autocode</b> Web
159
+ site first at <a
160
+ href="http://code.google.com/p/ruby-autocode">code.google.com/p/ruby-autocode</a>/.
161
+ </p>
162
+ <p>
163
+ (c) 2007 Dan Yoder
164
+ </p>
165
+ <p>
166
+ Licensed under the MIT License.
167
+ </p>
168
+
169
+ </div>
170
+
171
+
172
+ </div>
173
+
174
+
175
+ </div>
176
+
177
+
178
+ <!-- if includes -->
179
+
180
+ <div id="section">
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <!-- if method_list -->
190
+
191
+
192
+ </div>
193
+
194
+
195
+ <div id="validator-badges">
196
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
197
+ </div>
198
+
199
+ </body>
200
+ </html>
@@ -0,0 +1,110 @@
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>File: autocode.rb</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="fileHeader">
50
+ <h1>autocode.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/autocode.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Jan 04 20:11:26 -0800 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ autocreate&nbsp;&nbsp;
77
+ autoload&nbsp;&nbsp;
78
+ reloadable&nbsp;&nbsp;
79
+ </div>
80
+ </div>
81
+
82
+ </div>
83
+
84
+
85
+ </div>
86
+
87
+
88
+ <!-- if includes -->
89
+
90
+ <div id="section">
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+ <!-- if method_list -->
100
+
101
+
102
+ </div>
103
+
104
+
105
+ <div id="validator-badges">
106
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
107
+ </div>
108
+
109
+ </body>
110
+ </html>