class RDoc::Context
def find_symbol(symbol, method = nil)
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