Method: JsDuck::App#filter_classes

Defined in:
lib/jsduck/app.rb

#filter_classes(docs) ⇒ Object

Turns all aggregated data into Class objects. Depending on –ignore-global either keeps or discards the global class. Warnings for global members are printed regardless of that setting, but of course can be turned off using –warnings=-global



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/jsduck/app.rb', line 130

def filter_classes(docs)
  classes = []
  docs.each do |d|
    cls = Class.new(d)
    if d[:name] != "global"
      classes << cls
    else
      # add global class only if --ignore-global not specified
      classes << cls unless @opts.ignore_global

      # Print warning for each global member
      cls.all_local_members.each do |m|
        type = m[:tagname].to_s
        name = m[:name]
        file = m[:files][0]
        Logger.instance.warn(:global, "Global #{type}: #{name}", file[:filename], file[:linenr])
      end
    end
  end
  Relations.new(classes, @opts.external_classes)
end