Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more
We found this class in more tha one place, so add in the name from there.
# File rdoc/ri/ri_cache.rb, line 19
def add_path(path)
@path_names << path
end
Return a list of all out method names
# File rdoc/ri/ri_cache.rb, line 102
def all_method_names
res = @class_methods.map {|m| m.full_name }
@instance_methods.each {|m| res << m.full_name}
res
end
# File rdoc/ri/ri_cache.rb, line 67
def classes_and_modules
@inferior_classes
end
Return an exact match to a particular name
# File rdoc/ri/ri_cache.rb, line 72
def contained_class_named(name)
@inferior_classes.find {|c| c.name == name}
end
Return a list of any classes or modules that we contain that match a given string
# File rdoc/ri/ri_cache.rb, line 63
def contained_modules_matching(name)
@inferior_classes.find_all {|c| c.name[name]}
end
Return our full name
# File rdoc/ri/ri_cache.rb, line 95
def full_name
res = @in_class.full_name
res << "::" unless res.empty?
res << @name
end
read in our methods and any classes and modules in our namespace. Methods are stored in files called name-c|i.yaml, where the 'name' portion is the external form of the method name and the c|i is a class|instance flag
# File rdoc/ri/ri_cache.rb, line 30
def load_from(dir)
Dir.foreach(dir) do |name|
next if name =~ /^\./
# convert from external to internal form, and
# extract the instance/class flag
if name =~ /^(.*?)-(c|i).yaml$/
external_name = $1
is_class_method = $2 == "c"
internal_name = RiWriter.external_to_internal(external_name)
list = is_class_method ? @class_methods : @instance_methods
path = File.join(dir, name)
list << MethodEntry.new(path, internal_name, is_class_method, self)
else
full_name = File.join(dir, name)
if File.directory?(full_name)
inf_class = @inferior_classes.find {|c| c.name == name }
if inf_class
inf_class.add_path(full_name)
else
inf_class = ClassEntry.new(full_name, name, self)
@inferior_classes << inf_class
end
inf_class.load_from(full_name)
end
end
end
end
return the list of local methods matching name We're split into two because we need distinct behavior when called from the toplevel
# File rdoc/ri/ri_cache.rb, line 79
def methods_matching(name, is_class_method)
local_methods_matching(name, is_class_method)
end
Find methods matching 'name' in ourselves and in any classes we contain
# File rdoc/ri/ri_cache.rb, line 85
def recursively_find_methods_matching(name, is_class_method)
res = local_methods_matching(name, is_class_method)
@inferior_classes.each do |c|
res.concat(c.recursively_find_methods_matching(name, is_class_method))
end
res
end