Class: RI::RiReader

Class | RI::RiReader
In: | rdoc/ri/ri_reader.rb
Parent: | Object

### Methods

all_names find_class_by_name find_methods full_class_names get_class get_method lookup_namespace_in new top_level_namespace

### Public Class methods

new(ri_cache)

[Source]

    # File rdoc/ri/ri_reader.rb, line 8
        def initialize(ri_cache)
          @cache = ri_cache
        end

### Public Instance methods

all_names()

return a list of all classes, modules, and methods

[Source]

    # File rdoc/ri/ri_reader.rb, line 71
        def all_names
          res = []
          find_names_in(res, @cache.toplevel)
        end

find_class_by_name(full_name)

[Source]

    # File rdoc/ri/ri_reader.rb, line 24
        def find_class_by_name(full_name)
          names = full_name.split(/::/)
          ns = @cache.toplevel
          for name in names
            ns = ns.contained_class_named(name)
            return nil if ns.nil?
          end
          get_class(ns)
        end

find_methods(name, is_class_method, namespaces)

[Source]

    # File rdoc/ri/ri_reader.rb, line 34
        def find_methods(name, is_class_method, namespaces)
          result = []
          namespaces.each do |ns|
            result.concat ns.methods_matching(name, is_class_method)
          end
          result
        end

full_class_names()

return the names of all classes and modules

[Source]

    # File rdoc/ri/ri_reader.rb, line 65
        def full_class_names
          res = []
          find_classes_in(res, @cache.toplevel)
        end

get_class(class_entry)

Return a class description

[Source]

    # File rdoc/ri/ri_reader.rb, line 50
        def get_class(class_entry)
          result = nil
          for path in class_entry.path_names
            path = RiWriter.class_desc_path(path, class_entry)
            desc = File.open(path) {|f| RI::Description.deserialize(f) }
            if result
              result.merge_in(desc)
            else
              result = desc
            end
          end
          result
        end

get_method(method_entry)

return the MethodDescription for a given MethodEntry by deserializing the YAML

[Source]

    # File rdoc/ri/ri_reader.rb, line 44
        def get_method(method_entry)
          path = method_entry.path_name
          File.open(path) { |f| RI::Description.deserialize(f) }
        end

lookup_namespace_in(target, namespaces)

[Source]

    # File rdoc/ri/ri_reader.rb, line 16
        def lookup_namespace_in(target, namespaces)
          result = []
          for n in namespaces
            result.concat(n.contained_modules_matching(target))
          end
          result
        end

top_level_namespace()

[Source]

    # File rdoc/ri/ri_reader.rb, line 12
        def top_level_namespace
          [ @cache.toplevel ]
        end

[Validate]