class JsDuck::Process::GlobalMembers

Prints warning for each global member. Removes “global” class when –ignore-global option used. Warnings for global members are printed regardless of that setting, but of course can be turned off using –warnings=-global

Public Class Methods

new(classes_hash, opts) click to toggle source
# File lib/jsduck/process/global_members.rb, line 11
def initialize(classes_hash, opts)
  @classes_hash = classes_hash
  @opts = opts
end

Public Instance Methods

process_all!() click to toggle source
# File lib/jsduck/process/global_members.rb, line 16
def process_all!
  # Do nothing when there's no "global" class.
  return unless @classes_hash["global"]

  # Warnings for each global member
  @classes_hash["global"][:members].each do |m|
    type = m[:tagname].to_s
    name = m[:name]
    Logger.warn(:global, "Global #{type}: #{name}", m[:files][0])
  end

  # Throw away the "global" class when --ignore-global option used
  if @opts.ignore_global
    @classes_hash.delete("global")
  end
end