Sha256: 33cce4db7152f7eb65ed67e4139193b5f923d14451bf0021af13a4459bb004ec

Contents?: true

Size: 1020 Bytes

Versions: 3

Compression:

Stored size: 1020 Bytes

Contents

module JsDuck
  module Warning

    # A composite warning, encompassing all the other warning types.
    class All

      # Creates a deprecated warning with a mapping to :nodoc warning
      # type with given parameters.  The warning is disabled by
      # default.
      def initialize(warnings)
        @warnings = warnings
      end

      # Enables/disables all warnings.
      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) unless path_pattern && w.enabled? == enabled
        end
      end

      # Doesn't make sense to check if the :all warning is enabled.
      def enabled?(filename="", params=[])
        raise "Warning type 'all' must not be checked for enabled/disabled"
      end

      # The all-warning is documented separately
      def doc
        nil
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jsduck-5.3.1 lib/jsduck/warning/all.rb
jsduck-5.3.0 lib/jsduck/warning/all.rb
jsduck-5.2.0 lib/jsduck/warning/all.rb