Class: JsDuck::Tag::New

Inherits:
BooleanTag show all
Defined in:
lib/jsduck/tag/new.rb

Constant Summary

Constants inherited from Tag

Tag::POS_ASIDE, Tag::POS_DEFAULT, Tag::POS_DEPRECATED, Tag::POS_DOC, Tag::POS_ENUM, Tag::POS_FIRES, Tag::POS_LOCALDOC, Tag::POS_OVERRIDES, Tag::POS_PARAM, Tag::POS_PREVENTABLE, Tag::POS_PRIVATE, Tag::POS_RETURN, Tag::POS_SINCE, Tag::POS_SUBPROPERTIES, Tag::POS_TEMPLATE, Tag::POS_THROWS, Tag::PRIORITY_CLASS, Tag::PRIORITY_COMPONENT, Tag::PRIORITY_SINGLETON

Instance Attribute Summary

Attributes inherited from Tag

#class_icon, #css, #ext_define_default, #ext_define_pattern, #html_position, #pattern, #repeatable, #signature, #tagname

Instance Method Summary collapse

Methods inherited from BooleanTag

#parse_doc, #process_doc

Methods inherited from Tag

descendants, #format, #parse_doc, #parse_ext_define, #process_doc, #to_html

Constructor Details

#initializeNew

Returns a new instance of New.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jsduck/tag/new.rb', line 5

def initialize
  @pattern = "new"
  # A :tooltip field gets injected to this signature in Process::Versions
  @signature = {:long => "★", :short => "★"}
  # black (docs text color) unicode star on yellow background
  @css = <<-EOCSS
    .signature .new {
      color: #484848;
      background-color: #F5D833;
    }
  EOCSS
  super
end

Instance Method Details

#init_tooltip!(opts) ⇒ Object

Initializes the tooltip text based on the –new-since and –import options passed from command line.

NOTE: This method is explicitly called from JsDuck::Options class.



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

def init_tooltip!(opts)
  if opts.new_since
    @signature[:tooltip] = "New since #{opts.new_since}"
  elsif opts.import.length > 0
    @signature[:tooltip] = "New since #{opts.import.last[:version]}"
  end
end