2003-12-16 05:44:25 +00:00
|
|
|
require 'rdoc/ri/ri_descriptions'
|
|
|
|
require 'rdoc/ri/ri_writer'
|
|
|
|
require 'rdoc/markup/simple_markup/to_flow'
|
|
|
|
|
|
|
|
module RI
|
|
|
|
class RiReader
|
|
|
|
|
|
|
|
def initialize(ri_cache)
|
|
|
|
@cache = ri_cache
|
|
|
|
end
|
|
|
|
|
|
|
|
def top_level_namespace
|
|
|
|
[ @cache.toplevel ]
|
|
|
|
end
|
|
|
|
|
|
|
|
def lookup_namespace_in(target, namespaces)
|
|
|
|
result = []
|
|
|
|
for n in namespaces
|
|
|
|
result.concat(n.contained_modules_matching(target))
|
|
|
|
end
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_methods(name, is_class_method, namespaces)
|
|
|
|
result = []
|
|
|
|
namespaces.each do |ns|
|
2003-12-16 20:28:44 +00:00
|
|
|
result.concat ns.methods_matching(name, is_class_method)
|
2003-12-16 05:44:25 +00:00
|
|
|
end
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
# return the MethodDescription for a given MethodEntry
|
|
|
|
# by deserializing the YAML
|
|
|
|
def get_method(method_entry)
|
|
|
|
path = method_entry.path_name
|
|
|
|
File.open(path) { |f| RI::Description.deserialize(f) }
|
|
|
|
end
|
|
|
|
|
|
|
|
# Return a class description
|
|
|
|
def get_class(class_entry)
|
|
|
|
path = RiWriter.class_desc_path(class_entry.path_name, class_entry)
|
|
|
|
File.open(path) {|f| RI::Description.deserialize(f) }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|