Class: JsDuck::Warning::Deprecated

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

Overview

A deprecated :no_doc* warning which maps to the new :nodoc warning.

Instance Method Summary collapse

Constructor Details

#initialize(type, msg, nodoc, params) ⇒ Deprecated

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



13
14
15
16
17
18
19
# File 'lib/jsduck/warning/deprecated.rb', line 13

def initialize(type, msg, nodoc, params)
  @type = type
  @msg = msg
  @enabled = false
  @nodoc = nodoc
  @params = params
end

Instance Method Details

#docObject

Documentation for the warning.



33
34
35
# File 'lib/jsduck/warning/deprecated.rb', line 33

def doc
  " -#{@type} - #{@msg} DEPRECATED"
end

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

This method shouldn’t be called.

Returns:

  • (Boolean)


28
29
30
# File 'lib/jsduck/warning/deprecated.rb', line 28

def enabled?(filename="", params=[])
  raise "Deprecated warning '#{@type}' must not be checked for enabled/disabled"
end

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

Enables or disables the mapped :nodoc warning.

Raises:



22
23
24
25
# File 'lib/jsduck/warning/deprecated.rb', line 22

def set(enabled, path_pattern=nil, params=[])
  @nodoc.set(enabled, path_pattern, @params)
  raise WarnException, "Warning type #{@type} is deprecated, use nodoc(#{@params.join(',')}) instead"
end