summaryrefslogtreecommitdiffstats
path: root/lib/rdoc/ri/ri_reader.rb
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-16 05:44:25 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-16 05:44:25 +0000
commitd3e92ce85e33191d2bbdf5bbb0d2afdd31dbd162 (patch)
tree0d09db2cbe31c84eac3c29575e7008c9d7a6d57b /lib/rdoc/ri/ri_reader.rb
parent23bbc2f292b4bd0c4cf7af906e69aaf9533f998c (diff)
downloadruby-d3e92ce85e33191d2bbdf5bbb0d2afdd31dbd162.tar.gz
ruby-d3e92ce85e33191d2bbdf5bbb0d2afdd31dbd162.tar.xz
ruby-d3e92ce85e33191d2bbdf5bbb0d2afdd31dbd162.zip
Initial load of support for ri/rdoc integration
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/ri/ri_reader.rb')
-rw-r--r--lib/rdoc/ri/ri_reader.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/rdoc/ri/ri_reader.rb b/lib/rdoc/ri/ri_reader.rb
new file mode 100644
index 000000000..f7e9e3074
--- /dev/null
+++ b/lib/rdoc/ri/ri_reader.rb
@@ -0,0 +1,46 @@
+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|
+ result.concat ns.methods_matching(name)
+ 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