Method: RDoc::PuppetClass#find_symbol

Defined in:
lib/puppet/util/rdoc/code_objects.rb

#find_symbol(symbol, method = nil) ⇒ Object

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.



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/puppet/util/rdoc/code_objects.rb', line 148

def find_symbol(symbol, method = nil)
  result = super(symbol)
  if !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 |mod|
          previous = result
          last_name = mod
          result = result.find_module_named(mod)
          break unless result
        end
        unless result
          result = previous
          method = last_name
        end
      end
    end
    if result && method
      unless result.respond_to?(:find_local_symbol)
        p result.name
        p method
        fail
      end
      result = result.find_local_symbol(method)
    end
  end
  result
end