# 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
_modules

### 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

None

### Class Methods

None

### Methods

Attribute | Constructor

### Static Methods

None

#### Attribute (Constructor)

Attribute(module, name, file, lineno)

Constructor

module
  name of the module containing this class
name
  name of this class
file
  filename containing this attribute
lineno
  linenumber of the class definition

Up

## Class

Class to represent a Ruby class.

### Derived from

ClbrBaseClasses.Class, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

Class | Constructor

### Static Methods

None

#### Class (Constructor)

Class(module, name, superClasses, file, lineno)

Constructor

module
  name of the module containing this class
name
  name of this class
superClasses
  list of class names this class is inherited from
file
  filename containing this class
lineno
  linenumber of the class definition

Up

## Function

Class to represent a Ruby function.

### Derived from

ClbrBaseClasses.Function, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

Function | Constructor

### Static Methods

None

#### Function (Constructor)

Function(module, name, file, lineno, signature='', separator=', ')

Constructor

module
  name of the module containing this function
name
  name of this function
file
  filename containing this class
lineno
  linenumber of the class definition
signature
  parameterlist of the method
separator
  string separating the parameters

Up

## Module

Class to represent a Ruby module.

### Derived from

ClbrBaseClasses.Module, VisibilityMixin

### Class Attributes

None

### Class Methods

None

### Methods

Module | Constructor

### Static Methods

None

#### Module (Constructor)

Module(module, name, file, lineno)

Constructor

module
  name of the module containing this class
name
  name of this class
file
  filename containing this class
lineno
  linenumber of the class definition

Up

## VisibilityMixin

Mixin class implementing the notion of visibility.

### Derived from

ClbrBaseClasses.ClbrVisibilityMixinBase

### Class Attributes

None

### Class Methods

None

### Methods

VisibilityMixin | Constructor

### Static Methods

None

#### VisibilityMixin (Constructor)

VisibilityMixin()

Constructor

Up

## readmodule_ex

readmodule_ex(module, path=None)

Read a Ruby file and return a dictionary of classes, functions and modules.

module
  name of the Ruby file (string)
path
  path the file should be searched in (list of strings)

Return:
  the resulting dictionary

Up

## 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

Up