summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/rdoc/code_objects.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2011-02-25 15:50:26 -0800
committerJesse Wolfe <jes5199@gmail.com>2011-02-25 15:50:26 -0800
commitfb02430e3d3baaab74175236fb6dfc9e931b6a8e (patch)
tree784f3e38d9c864711556b64c9a3d1d28282181ef /lib/puppet/util/rdoc/code_objects.rb
parent96e9f8f4feab5d768fff304fdb129405596ba128 (diff)
parent90905073a6e1136c80cd59dca1a9594f4a859126 (diff)
downloadpuppet-fb02430e3d3baaab74175236fb6dfc9e931b6a8e.tar.gz
puppet-fb02430e3d3baaab74175236fb6dfc9e931b6a8e.tar.xz
puppet-fb02430e3d3baaab74175236fb6dfc9e931b6a8e.zip
Merge remote branch 'brice/tickets/2.6.x/6267' into 2.6.next
Diffstat (limited to 'lib/puppet/util/rdoc/code_objects.rb')
-rw-r--r--lib/puppet/util/rdoc/code_objects.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/puppet/util/rdoc/code_objects.rb b/lib/puppet/util/rdoc/code_objects.rb
index 3854fbc01..3c789a0c5 100644
--- a/lib/puppet/util/rdoc/code_objects.rb
+++ b/lib/puppet/util/rdoc/code_objects.rb
@@ -124,6 +124,45 @@ module RDoc
def add_child(child)
@childs << child
end
+
+ # Look up the given symbol. RDoc only looks for class1::class2.method
+ # or class1::class2#method. Since our definitions are mapped to RDoc methods
+ # but are written class1::class2::define we need to perform the lookup by
+ # ourselves.
+ def find_symbol(symbol, method=nil)
+ result = super
+ if not result and symbol =~ /::/
+ modules = symbol.split(/::/)
+ unless modules.empty?
+ module_name = modules.shift
+ result = find_module_named(module_name)
+ if result
+ last_name = ""
+ previous = nil
+ modules.each do |module_name|
+ previous = result
+ last_name = module_name
+ result = result.find_module_named(module_name)
+ break unless result
+ end
+ unless result
+ result = previous
+ method = last_name
+ end
+ end
+ end
+ if result && method
+ if !result.respond_to?(:find_local_symbol)
+ p result.name
+ p method
+ fail
+ end
+ result = result.find_local_symbol(method)
+ end
+ end
+ result
+ end
+
end
# PuppetNode holds a puppet node