Class: JsDuck::Tag::Deprecated

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

Overview

Implementation of @deprecated tag

Instance Attribute Summary

Attributes inherited from MetaTag

#assets, #boolean, #context, #formatter, #key, #multiline, #name, #position, #signature

Instance Method Summary collapse

Methods inherited from MetaTag

descendants, #format

Constructor Details

#initializeDeprecated

Returns a new instance of Deprecated.



6
7
8
9
10
11
# File 'lib/jsduck/tag/deprecated.rb', line 6

def initialize
  @name = "deprecated"
  @key = :deprecated
  @signature = {:long => "deprecated", :short => "DEP"}
  @multiline = true
end

Instance Method Details

#to_html(depr) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/jsduck/tag/deprecated.rb', line 22

def to_html(depr)
  v = depr[:version] ? "since " + depr[:version] : ""
  <<-EOHTML
    <div class='signature-box deprecated'>
    <p>This #{@context[:tagname]} has been <strong>deprecated</strong> #{v}</p>
    #{format(depr[:text])}
    </div>
  EOHTML
end

#to_value(contents) ⇒ Object



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

def to_value(contents)
  text = contents[0]
  if text =~ /\A([0-9.]+)(.*)\Z/
    {:version => $1, :text => $2.strip}
  else
    {:text => text || ""}
  end
end