Class: RDocF95::RI::Reader
- Inherits:
-
Object
- Object
- RDocF95::RI::Reader
- Defined in:
- lib/rdoc-f95/ri/reader.rb
Instance Method Summary collapse
-
#all_names ⇒ Object
Return a list of all classes, modules, and methods.
- #find_class_by_name(full_name) ⇒ Object
- #find_methods(name, is_class_method, namespaces) ⇒ Object
-
#full_class_names ⇒ Object
Return the names of all classes and modules.
-
#get_class(class_entry) ⇒ Object
Return a class description.
-
#get_method(method_entry) ⇒ Object
Return the MethodDescription for a given MethodEntry by deserializing the YAML.
-
#initialize(ri_cache) ⇒ Reader
constructor
A new instance of Reader.
- #lookup_namespace_in(target, namespaces) ⇒ Object
- #top_level_namespace ⇒ Object
Constructor Details
permalink #initialize(ri_cache) ⇒ Reader
Returns a new instance of Reader.
8 9 10 |
# File 'lib/rdoc-f95/ri/reader.rb', line 8 def initialize(ri_cache) @cache = ri_cache end |
Instance Method Details
permalink #all_names ⇒ Object
Return a list of all classes, modules, and methods
79 80 81 82 |
# File 'lib/rdoc-f95/ri/reader.rb', line 79 def all_names res = [] find_names_in(res, @cache.toplevel) end |
permalink #find_class_by_name(full_name) ⇒ Object
[View source]
24 25 26 27 28 29 30 31 32 |
# File 'lib/rdoc-f95/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 |
permalink #find_methods(name, is_class_method, namespaces) ⇒ Object
[View source]
34 35 36 37 38 39 40 |
# File 'lib/rdoc-f95/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 |
permalink #full_class_names ⇒ Object
Return the names of all classes and modules
71 72 73 74 |
# File 'lib/rdoc-f95/ri/reader.rb', line 71 def full_class_names res = [] find_classes_in(res, @cache.toplevel) end |
permalink #get_class(class_entry) ⇒ Object
Return a class description
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rdoc-f95/ri/reader.rb', line 54 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 |
permalink #get_method(method_entry) ⇒ Object
Return the MethodDescription for a given MethodEntry by deserializing the YAML
46 47 48 49 |
# File 'lib/rdoc-f95/ri/reader.rb', line 46 def get_method(method_entry) path = method_entry.path_name File.open(path) { |f| RI::Description.deserialize(f) } end |
permalink #lookup_namespace_in(target, namespaces) ⇒ Object
[View source]
16 17 18 19 20 21 22 |
# File 'lib/rdoc-f95/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 |
permalink #top_level_namespace ⇒ Object
[View source]
12 13 14 |
# File 'lib/rdoc-f95/ri/reader.rb', line 12 def top_level_namespace [ @cache.toplevel ] end |