Class: JsDuck::Warning::All

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/warning/all.rb

Overview

A composite warning, encompassing all the other warning types.

Instance Method Summary collapse

Constructor Details

#initialize(warnings) ⇒ All

Creates a deprecated warning with a mapping to :nodoc warning type with given parameters. The warning is disabled by default.



10
11
12
# File 'lib/jsduck/warning/all.rb', line 10

def initialize(warnings)
  @warnings = warnings
end

Instance Method Details

#docObject

The all-warning is documented separately



29
30
31
# File 'lib/jsduck/warning/all.rb', line 29

def doc
  nil
end

#enabled?(filename = "", params = []) ⇒ Boolean

Doesn’t make sense to check if the :all warning is enabled.

Returns:

  • (Boolean)


24
25
26
# File 'lib/jsduck/warning/all.rb', line 24

def enabled?(filename="", params=[])
  raise "Warning type 'all' must not be checked for enabled/disabled"
end

#set(enabled, path_pattern = nil, params = []) ⇒ Object

Enables/disables all warnings.



15
16
17
18
19
20
21
# File 'lib/jsduck/warning/all.rb', line 15

def set(enabled, path_pattern=nil, params=[])
  # When used with a path_pattern, only add the pattern to the rules
  # where it can have an effect - otherwise we get a warning.
  @warnings.each do |w|
    w.set(enabled, path_pattern, params)
  end
end