Method: JsDuck::Class#lookup

Defined in:
lib/jsduck/class.rb

#lookup(classname) ⇒ Object

Looks up class object by name When not found, prints warning message.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/jsduck/class.rb', line 107

def lookup(classname)
  if @relations[classname]
    @relations[classname]
  elsif @relations.ignore?(classname) || classname =~ /\*/
    # Ignore explicitly ignored classes and classnames with
    # wildcards in them.  We could expand the wildcard, but that
    # can result in a very long list of classes, like when
    # somebody requires 'Ext.form.*', so for now we do the
    # simplest thing and ignore it.
    Class.new({:name => classname}, false)
  else
    context = @doc[:files][0]
    Logger.warn(:extend, "Class #{classname} not found", context[:filename], context[:linenr])
    # Create placeholder class
    Class.new({:name => classname}, false)
  end
end