eric7.Utilities.ClassBrowsers.rbclbr
Parse a Ruby file and retrieve classes, modules, methods and attributes.
Parse enough of a Ruby file to recognize class, module and method definitions
and to find out the superclasses of a class as well as its attributes.
It is based on the Python class browser found in this package.
Global Attributes
SUPPORTED_TYPES |
_commentsub |
_getnext |
Classes
Attribute |
Class to represent a class or module attribute. |
Class |
Class to represent a Ruby class. |
Function |
Class to represent a Ruby function. |
Module |
Class to represent a Ruby module. |
VisibilityMixin |
Mixin class implementing the notion of visibility. |
Functions
readmodule_ex |
Read a Ruby file and return a dictionary of classes, functions and modules. |
scan |
Public method to scan the given source text. |
Attribute
Class to represent a class or module attribute.
Derived from
ClbrBaseClasses.Attribute, VisibilityMixin
Class Attributes
Class Methods
Methods
Static Methods
Attribute (Constructor)
Attribute(module, name, file, lineno, col_offset=0)
Constructor
- module (str)
-
name of the module containing this attribute
- name (str)
-
name of this attribute
- file (str)
-
file name containing this attribute
- lineno (int)
-
line number of the attribute definition
- col_offset (int (optional))
-
column number of the attribute definition (defaults to 0)
Class
Class to represent a Ruby class.
Derived from
ClbrBaseClasses.Class, VisibilityMixin
Class Attributes
Class Methods
Methods
Static Methods
Class (Constructor)
Class(module, name, superClasses, file, lineno, col_offset=0)
Constructor
- module (str)
-
name of the module containing this class
- name (str)
-
name of this class
- superClasses (list of str)
-
list of class names this class is inherited from
- file (str)
-
file name containing this class
- lineno (int)
-
line number of the class definition
- col_offset (int (optional))
-
column number of the class definition (defaults to 0)
Function
Class to represent a Ruby function.
Derived from
ClbrBaseClasses.Function, VisibilityMixin
Class Attributes
Class Methods
Methods
Static Methods
Function (Constructor)
Function(module, name, file, lineno, col_offset=0, signature="", separator=", ")
Constructor
- module (str)
-
name of the module containing this function
- name (str)
-
name of this function
- file (str)
-
file name containing this function
- lineno (int)
-
line number of the function definition
- col_offset (int (optional))
-
column number of the function definition (defaults to 0)
- signature (str)
-
parameter list of the function
- separator (str)
-
string separating the parameters
Module
Class to represent a Ruby module.
Derived from
ClbrBaseClasses.Module, VisibilityMixin
Class Attributes
Class Methods
Methods
Static Methods
Module (Constructor)
Module(module, name, file, lineno, col_offset=0)
Constructor
- module (str)
-
name of the module containing this module
- name (str)
-
name of this module
- file (str)
-
file name containing this module
- lineno (int)
-
linenumber of the module definition
- col_offset (int (optional))
-
column number of the module definition (defaults to 0)
VisibilityMixin
Mixin class implementing the notion of visibility.
Derived from
ClbrBaseClasses.ClbrVisibilityMixinBase
Class Attributes
Class Methods
Methods
Static Methods
VisibilityMixin (Constructor)
VisibilityMixin()
Constructor
readmodule_ex
readmodule_ex(module, path=None, isTypeFile=False)
Read a Ruby file and return a dictionary of classes, functions and modules.
- module (str)
-
name of the Ruby file
- path (list of str)
-
path the file should be searched in
- isTypeFile (bool)
-
flag indicating a file of this type (unused)
- Return:
-
the resulting dictionary
- Return Type:
-
dict
scan
scan(src, file, module)
Public method to scan the given source text.
- src (str)
-
source text to be scanned
- file (str)
-
file name associated with the source text
- module (str)
-
module name associated with the source text
- Return:
-
dictionary containing the extracted data
- Return Type:
-
dict