Class: FastRI::RiIndex

Class | FastRI::RiIndex
In: | lib/fastri/ri_index.rb
Parent: | Object

This class provides the same functionality as RiReader, with some improvements:

- lower memory consumption
- ability to handle information from different sources separately.

Some operations can be restricted to a given "scope", that is, a "RI DB directory". This allows you to e.g. look for all the instance methods in String defined by a package.

Such operations take a `scope` argument, which is either an integer which indexes the source in paths, or a name identifying the source (either "system" or a package name). If `scope == nil`, the information from all sources is merged.

### Methods

all_names dump find_class_by_name find_method_by_name find_methods full_class_names full_method_names get_class get_class_entry get_method get_method_entry load lookup_namespace_in methods_under methods_under_matching namespaces_under namespaces_under_matching new_from_IO new_from_paths num_methods num_namespaces rebuild_index source_paths_for top_level_namespace

### Classes and Modules

Class FastRI::RiIndex::ClassEntry
Class FastRI::RiIndex::MethodEntry
Class FastRI::RiIndex::TopLevelEntry

### Constants

MAGIC | = | "FastRI index #{FASTRI_INDEX_FORMAT}"

### Attributes

paths | [R] |

### Public Class methods

new_from_IO(anIO)
new_from_paths(paths = nil)

### Public Instance methods

all_names(scope = nil)

Return a list of all classes, modules, and methods.

dump(anIO)

Serializes index to the given IO.

find_class_by_name(full_name, scope = nil)

Returns the ClassDescription associated to the given `full_name`.

find_method_by_name(full_name, scope = nil)

Returns the MethodDescription associated to the given `full_name`. Only the first definition is returned when `scope = nil`.

find_methods(name, is_class_method, namespaces)

Returns an array of MethodEntry objects, corresponding to the methods in the ClassEntry objects in the `namespaces` array.

full_class_names(scope = nil)

Return the names of all classes and modules.

full_method_names(scope = nil)

Return the names of all methods.

get_class(class_entry)

Return a ClassDescription for a given ClassEntry.

get_class_entry(full_name, scope = nil)

Returns the ClassEntry associated to the given `full_name`.

get_method(method_entry)

Return the MethodDescription for a given MethodEntry by deserializing the YAML.

get_method_entry(full_name, scope = nil)

Returns the MethodEntry associated to the given `full_name`.

load(anIO)

Load the index from the given IO. It must contain a textual representation generated by dump.

lookup_namespace_in(target, namespaces)

Returns an array of ClassEntry objects whose names match `target`, and which correspond to the namespaces contained in `namespaces`. `namespaces` is an array of ClassEntry objects.

methods_under(class_entry_or_name, recursive, scope = nil)

Returns array of MethodEntry objects under class_entry_or_name (either String or ClassEntry) in the hierarchy.

methods_under_matching(class_entry_or_name, regexp, recursive, scope = nil)

Returns array of MethodEntry objects under class_entry_or_name (either String or ClassEntry) in the hierarchy whose `full_name` matches the given regexp.

namespaces_under(class_entry_or_name, recursive, scope = nil)

Returns array of ClassEntry objects under class_entry_or_name (either String or ClassEntry) in the hierarchy.

namespaces_under_matching(class_entry_or_name, regexp, recursive, scope = nil)

Returns array of ClassEntry objects under class_entry_or_name (either String or ClassEntry) in the hierarchy whose `full_name` matches the given regexp.

num_methods()

Returns the number of methods in the index.

num_namespaces()

Returns the number of namespaces in the index.

rebuild_index(paths = nil)
source_paths_for(entry_or_name)

Returns array of Strings corresponding to the base directories of all the sources fo the given entry_or_name.

top_level_namespace(scope = nil)

Returns an array with the top level namespace.

[Validate]