Class: JsDuck::Tag::New

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

Overview

Implementation of @new 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, #to_html

Constructor Details

#initializeNew

Returns a new instance of New.



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

def initialize
  @name = "new"
  @key = :new
  @signature = {:long => "★", :short => "★"} # unicode black star char
  @boolean = true
end

Instance Method Details

#create_tooltip!(imports, new_since) ⇒ Object

Initializes the tooltip text.

HACK: This is a special method that’s only called for the @new tag. It doesn’t fit well into the current meta-tags system. But until we rework the meta-tags system, this will have to do.



19
20
21
22
23
24
25
# File 'lib/jsduck/tag/new.rb', line 19

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

#to_value(contents) ⇒ Object



27
28
29
# File 'lib/jsduck/tag/new.rb', line 27

def to_value(contents)
  true
end