method
find_symbol
v1_9_2_180 -
Show latest stable
- Class:
RDoc::Context
find_symbol(symbol, method = nil)public
Look up symbol. If method is non-nil, then we assume the symbol references a module that contains that method.
# File lib/rdoc/context.rb, line 588
def find_symbol(symbol, method = nil)
result = nil
case symbol
when /^::([A-Z].*)/ then
result = top_level.find_symbol($1)
when /::/ then
modules = symbol.split(/::/)
unless modules.empty? then
module_name = modules.shift
result = find_module_named(module_name)
if result then
modules.each do |name|
result = result.find_module_named name
break unless result
end
end
end
end
unless result then
# if a method is specified, then we're definitely looking for
# a module, otherwise it could be any symbol
if method then
result = find_module_named symbol
else
result = find_local_symbol symbol
if result.nil? then
if symbol =~ /^[A-Z]/ then
result = parent
while result && result.name != symbol do
result = result.parent
end
end
end
end
end
result = result.find_local_symbol method if result and method
result
end Related methods
- Instance methods
- <=>
- add_alias
- add_alias_impl
- add_attribute
- add_class
- add_class_or_module
- add_constant
- add_include
- add_method
- add_module
- add_module_alias
- add_require
- add_to
- child_name
- classes
- classes_and_modules
- classes_hash
- defined_in?
- each_attribute
- each_classmodule
- each_constant
- each_include
- each_method
- find_attribute_named
- find_class_method_named
- find_constant_named
- find_enclosing_module_named
- find_file_named
- find_instance_method_named
- find_local_symbol
- find_method_named
- find_module_named
- find_symbol
- full_name
- http_url
- initialize_classes_and_modules
- initialize_methods_etc
- methods_by_type
- methods_matching
- modules
- modules_hash
- ongoing_visibility=
- record_location
- remove_classes_and_modules
- remove_methods_etc
- set_current_section
- set_visibility_for
- top_level
- Class methods
- new