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

Methods

Public Class methods

[Source]

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

Public Instance methods

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

[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

[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

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

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

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

[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

[Source]

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

[Validate]

ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.