|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Utilities.ClassBrowsers.rbclbr</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.Utilities.ClassBrowsers.rbclbr</h1> |
|
10 |
|
11 <p> |
|
12 Parse a Ruby file and retrieve classes, modules, methods and attributes. |
|
13 </p> |
|
14 <p> |
|
15 Parse enough of a Ruby file to recognize class, module and method definitions |
|
16 and to find out the superclasses of a class as well as its attributes. |
|
17 </p> |
|
18 <p> |
|
19 It is based on the Python class browser found in this package. |
|
20 </p> |
|
21 <h3>Global Attributes</h3> |
|
22 |
|
23 <table> |
|
24 <tr><td>SUPPORTED_TYPES</td></tr><tr><td>_commentsub</td></tr><tr><td>_getnext</td></tr><tr><td>_modules</td></tr> |
|
25 </table> |
|
26 <h3>Classes</h3> |
|
27 |
|
28 <table> |
|
29 |
|
30 <tr> |
|
31 <td><a href="#Attribute">Attribute</a></td> |
|
32 <td>Class to represent a class or module attribute.</td> |
|
33 </tr> |
|
34 <tr> |
|
35 <td><a href="#Class">Class</a></td> |
|
36 <td>Class to represent a Ruby class.</td> |
|
37 </tr> |
|
38 <tr> |
|
39 <td><a href="#Function">Function</a></td> |
|
40 <td>Class to represent a Ruby function.</td> |
|
41 </tr> |
|
42 <tr> |
|
43 <td><a href="#Module">Module</a></td> |
|
44 <td>Class to represent a Ruby module.</td> |
|
45 </tr> |
|
46 <tr> |
|
47 <td><a href="#VisibilityMixin">VisibilityMixin</a></td> |
|
48 <td>Mixin class implementing the notion of visibility.</td> |
|
49 </tr> |
|
50 </table> |
|
51 <h3>Functions</h3> |
|
52 |
|
53 <table> |
|
54 |
|
55 <tr> |
|
56 <td><a href="#readmodule_ex">readmodule_ex</a></td> |
|
57 <td>Read a Ruby file and return a dictionary of classes, functions and modules.</td> |
|
58 </tr> |
|
59 <tr> |
|
60 <td><a href="#scan">scan</a></td> |
|
61 <td>Public method to scan the given source text.</td> |
|
62 </tr> |
|
63 </table> |
|
64 <hr /> |
|
65 <hr /> |
|
66 <a NAME="Attribute" ID="Attribute"></a> |
|
67 <h2>Attribute</h2> |
|
68 |
|
69 <p> |
|
70 Class to represent a class or module attribute. |
|
71 </p> |
|
72 <h3>Derived from</h3> |
|
73 ClbrBaseClasses.Attribute, VisibilityMixin |
|
74 <h3>Class Attributes</h3> |
|
75 |
|
76 <table> |
|
77 <tr><td>None</td></tr> |
|
78 </table> |
|
79 <h3>Class Methods</h3> |
|
80 |
|
81 <table> |
|
82 <tr><td>None</td></tr> |
|
83 </table> |
|
84 <h3>Methods</h3> |
|
85 |
|
86 <table> |
|
87 |
|
88 <tr> |
|
89 <td><a href="#Attribute.__init__">Attribute</a></td> |
|
90 <td>Constructor</td> |
|
91 </tr> |
|
92 </table> |
|
93 <h3>Static Methods</h3> |
|
94 |
|
95 <table> |
|
96 <tr><td>None</td></tr> |
|
97 </table> |
|
98 |
|
99 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> |
|
100 <h4>Attribute (Constructor)</h4> |
|
101 <b>Attribute</b>(<i>module, name, file, lineno</i>) |
|
102 |
|
103 <p> |
|
104 Constructor |
|
105 </p> |
|
106 <dl> |
|
107 |
|
108 <dt><i>module</i></dt> |
|
109 <dd> |
|
110 name of the module containing this class |
|
111 </dd> |
|
112 <dt><i>name</i></dt> |
|
113 <dd> |
|
114 name of this class |
|
115 </dd> |
|
116 <dt><i>file</i></dt> |
|
117 <dd> |
|
118 filename containing this attribute |
|
119 </dd> |
|
120 <dt><i>lineno</i></dt> |
|
121 <dd> |
|
122 linenumber of the class definition |
|
123 </dd> |
|
124 </dl> |
|
125 <div align="right"><a href="#top">Up</a></div> |
|
126 <hr /> |
|
127 <hr /> |
|
128 <a NAME="Class" ID="Class"></a> |
|
129 <h2>Class</h2> |
|
130 |
|
131 <p> |
|
132 Class to represent a Ruby class. |
|
133 </p> |
|
134 <h3>Derived from</h3> |
|
135 ClbrBaseClasses.Class, VisibilityMixin |
|
136 <h3>Class Attributes</h3> |
|
137 |
|
138 <table> |
|
139 <tr><td>None</td></tr> |
|
140 </table> |
|
141 <h3>Class Methods</h3> |
|
142 |
|
143 <table> |
|
144 <tr><td>None</td></tr> |
|
145 </table> |
|
146 <h3>Methods</h3> |
|
147 |
|
148 <table> |
|
149 |
|
150 <tr> |
|
151 <td><a href="#Class.__init__">Class</a></td> |
|
152 <td>Constructor</td> |
|
153 </tr> |
|
154 </table> |
|
155 <h3>Static Methods</h3> |
|
156 |
|
157 <table> |
|
158 <tr><td>None</td></tr> |
|
159 </table> |
|
160 |
|
161 <a NAME="Class.__init__" ID="Class.__init__"></a> |
|
162 <h4>Class (Constructor)</h4> |
|
163 <b>Class</b>(<i>module, name, superClasses, file, lineno</i>) |
|
164 |
|
165 <p> |
|
166 Constructor |
|
167 </p> |
|
168 <dl> |
|
169 |
|
170 <dt><i>module</i></dt> |
|
171 <dd> |
|
172 name of the module containing this class |
|
173 </dd> |
|
174 <dt><i>name</i></dt> |
|
175 <dd> |
|
176 name of this class |
|
177 </dd> |
|
178 <dt><i>superClasses</i></dt> |
|
179 <dd> |
|
180 list of class names this class is inherited from |
|
181 </dd> |
|
182 <dt><i>file</i></dt> |
|
183 <dd> |
|
184 filename containing this class |
|
185 </dd> |
|
186 <dt><i>lineno</i></dt> |
|
187 <dd> |
|
188 linenumber of the class definition |
|
189 </dd> |
|
190 </dl> |
|
191 <div align="right"><a href="#top">Up</a></div> |
|
192 <hr /> |
|
193 <hr /> |
|
194 <a NAME="Function" ID="Function"></a> |
|
195 <h2>Function</h2> |
|
196 |
|
197 <p> |
|
198 Class to represent a Ruby function. |
|
199 </p> |
|
200 <h3>Derived from</h3> |
|
201 ClbrBaseClasses.Function, VisibilityMixin |
|
202 <h3>Class Attributes</h3> |
|
203 |
|
204 <table> |
|
205 <tr><td>None</td></tr> |
|
206 </table> |
|
207 <h3>Class Methods</h3> |
|
208 |
|
209 <table> |
|
210 <tr><td>None</td></tr> |
|
211 </table> |
|
212 <h3>Methods</h3> |
|
213 |
|
214 <table> |
|
215 |
|
216 <tr> |
|
217 <td><a href="#Function.__init__">Function</a></td> |
|
218 <td>Constructor</td> |
|
219 </tr> |
|
220 </table> |
|
221 <h3>Static Methods</h3> |
|
222 |
|
223 <table> |
|
224 <tr><td>None</td></tr> |
|
225 </table> |
|
226 |
|
227 <a NAME="Function.__init__" ID="Function.__init__"></a> |
|
228 <h4>Function (Constructor)</h4> |
|
229 <b>Function</b>(<i>module, name, file, lineno, signature='', separator=', '</i>) |
|
230 |
|
231 <p> |
|
232 Constructor |
|
233 </p> |
|
234 <dl> |
|
235 |
|
236 <dt><i>module</i></dt> |
|
237 <dd> |
|
238 name of the module containing this function |
|
239 </dd> |
|
240 <dt><i>name</i></dt> |
|
241 <dd> |
|
242 name of this function |
|
243 </dd> |
|
244 <dt><i>file</i></dt> |
|
245 <dd> |
|
246 filename containing this class |
|
247 </dd> |
|
248 <dt><i>lineno</i></dt> |
|
249 <dd> |
|
250 linenumber of the class definition |
|
251 </dd> |
|
252 <dt><i>signature</i></dt> |
|
253 <dd> |
|
254 parameterlist of the method |
|
255 </dd> |
|
256 <dt><i>separator</i></dt> |
|
257 <dd> |
|
258 string separating the parameters |
|
259 </dd> |
|
260 </dl> |
|
261 <div align="right"><a href="#top">Up</a></div> |
|
262 <hr /> |
|
263 <hr /> |
|
264 <a NAME="Module" ID="Module"></a> |
|
265 <h2>Module</h2> |
|
266 |
|
267 <p> |
|
268 Class to represent a Ruby module. |
|
269 </p> |
|
270 <h3>Derived from</h3> |
|
271 ClbrBaseClasses.Module, VisibilityMixin |
|
272 <h3>Class Attributes</h3> |
|
273 |
|
274 <table> |
|
275 <tr><td>None</td></tr> |
|
276 </table> |
|
277 <h3>Class Methods</h3> |
|
278 |
|
279 <table> |
|
280 <tr><td>None</td></tr> |
|
281 </table> |
|
282 <h3>Methods</h3> |
|
283 |
|
284 <table> |
|
285 |
|
286 <tr> |
|
287 <td><a href="#Module.__init__">Module</a></td> |
|
288 <td>Constructor</td> |
|
289 </tr> |
|
290 </table> |
|
291 <h3>Static Methods</h3> |
|
292 |
|
293 <table> |
|
294 <tr><td>None</td></tr> |
|
295 </table> |
|
296 |
|
297 <a NAME="Module.__init__" ID="Module.__init__"></a> |
|
298 <h4>Module (Constructor)</h4> |
|
299 <b>Module</b>(<i>module, name, file, lineno</i>) |
|
300 |
|
301 <p> |
|
302 Constructor |
|
303 </p> |
|
304 <dl> |
|
305 |
|
306 <dt><i>module</i></dt> |
|
307 <dd> |
|
308 name of the module containing this class |
|
309 </dd> |
|
310 <dt><i>name</i></dt> |
|
311 <dd> |
|
312 name of this class |
|
313 </dd> |
|
314 <dt><i>file</i></dt> |
|
315 <dd> |
|
316 filename containing this class |
|
317 </dd> |
|
318 <dt><i>lineno</i></dt> |
|
319 <dd> |
|
320 linenumber of the class definition |
|
321 </dd> |
|
322 </dl> |
|
323 <div align="right"><a href="#top">Up</a></div> |
|
324 <hr /> |
|
325 <hr /> |
|
326 <a NAME="VisibilityMixin" ID="VisibilityMixin"></a> |
|
327 <h2>VisibilityMixin</h2> |
|
328 |
|
329 <p> |
|
330 Mixin class implementing the notion of visibility. |
|
331 </p> |
|
332 <h3>Derived from</h3> |
|
333 ClbrBaseClasses.ClbrVisibilityMixinBase |
|
334 <h3>Class Attributes</h3> |
|
335 |
|
336 <table> |
|
337 <tr><td>None</td></tr> |
|
338 </table> |
|
339 <h3>Class Methods</h3> |
|
340 |
|
341 <table> |
|
342 <tr><td>None</td></tr> |
|
343 </table> |
|
344 <h3>Methods</h3> |
|
345 |
|
346 <table> |
|
347 |
|
348 <tr> |
|
349 <td><a href="#VisibilityMixin.__init__">VisibilityMixin</a></td> |
|
350 <td>Constructor</td> |
|
351 </tr> |
|
352 </table> |
|
353 <h3>Static Methods</h3> |
|
354 |
|
355 <table> |
|
356 <tr><td>None</td></tr> |
|
357 </table> |
|
358 |
|
359 <a NAME="VisibilityMixin.__init__" ID="VisibilityMixin.__init__"></a> |
|
360 <h4>VisibilityMixin (Constructor)</h4> |
|
361 <b>VisibilityMixin</b>(<i></i>) |
|
362 |
|
363 <p> |
|
364 Constructor |
|
365 </p> |
|
366 <div align="right"><a href="#top">Up</a></div> |
|
367 <hr /> |
|
368 <hr /> |
|
369 <a NAME="readmodule_ex" ID="readmodule_ex"></a> |
|
370 <h2>readmodule_ex</h2> |
|
371 <b>readmodule_ex</b>(<i>module, path=None</i>) |
|
372 |
|
373 <p> |
|
374 Read a Ruby file and return a dictionary of classes, functions and modules. |
|
375 </p> |
|
376 <dl> |
|
377 |
|
378 <dt><i>module</i></dt> |
|
379 <dd> |
|
380 name of the Ruby file (string) |
|
381 </dd> |
|
382 <dt><i>path</i></dt> |
|
383 <dd> |
|
384 path the file should be searched in (list of strings) |
|
385 </dd> |
|
386 </dl> |
|
387 <dl> |
|
388 <dt>Return:</dt> |
|
389 <dd> |
|
390 the resulting dictionary |
|
391 </dd> |
|
392 </dl> |
|
393 <div align="right"><a href="#top">Up</a></div> |
|
394 <hr /> |
|
395 <hr /> |
|
396 <a NAME="scan" ID="scan"></a> |
|
397 <h2>scan</h2> |
|
398 <b>scan</b>(<i>src, file, module</i>) |
|
399 |
|
400 <p> |
|
401 Public method to scan the given source text. |
|
402 </p> |
|
403 <dl> |
|
404 |
|
405 <dt><i>src</i> (str)</dt> |
|
406 <dd> |
|
407 source text to be scanned |
|
408 </dd> |
|
409 <dt><i>file</i> (str)</dt> |
|
410 <dd> |
|
411 file name associated with the source text |
|
412 </dd> |
|
413 <dt><i>module</i> (str)</dt> |
|
414 <dd> |
|
415 module name associated with the source text |
|
416 </dd> |
|
417 </dl> |
|
418 <dl> |
|
419 <dt>Return:</dt> |
|
420 <dd> |
|
421 dictionary containing the extracted data |
|
422 </dd> |
|
423 </dl> |
|
424 <dl> |
|
425 <dt>Return Type:</dt> |
|
426 <dd> |
|
427 dict |
|
428 </dd> |
|
429 </dl> |
|
430 <div align="right"><a href="#top">Up</a></div> |
|
431 <hr /> |
|
432 </body></html> |