Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • rdoc/ri/ri_reader.rb

Files

Class/Module Index [+]

Quicksearch

RI::RiReader

Public Class Methods

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

Public Instance Methods

all_names() click to toggle source

return a list of all classes, modules, and methods

 
               # 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) click to toggle 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) click to toggle 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() click to toggle source

return the names of all classes and modules

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

Return a class description

 
               # 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) click to toggle source

return the MethodDescription for a given MethodEntry by deserializing the YAML

 
               # 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) click to toggle 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() click to toggle source
 
               # File rdoc/ri/ri_reader.rb, line 12
def top_level_namespace
  [ @cache.toplevel ]
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus