Class: JsDuck::Tag::Alias

Inherits:
Inheritdoc show all
Defined in:
lib/jsduck/tag/alias.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 Inheritdoc

#parse_as_inheritdoc

Methods inherited from Tag

descendants, #format, #to_html

Constructor Details

#initializeAlias

Returns a new instance of Alias.



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

def initialize
  @pattern = "alias"
  @tagname = :aliases
  @repeatable = true
  @ext_define_pattern = "alias"
  @ext_define_default = {:aliases => []}
end

Instance Method Details

#parse_as_alias(p) ⇒ Object



26
27
28
29
30
31
# File 'lib/jsduck/tag/alias.rb', line 26

def parse_as_alias(p)
  {
    :tagname => :aliases,
    :name => p.ident_chain,
  }
end

#parse_doc(p, pos) ⇒ Object

For backwards compatibility decide whether the @alias was used as @inheritdoc (@alias used to have the meaning of @inheritdoc before) or as a real Ext4 style alias definition.



17
18
19
20
21
22
23
# File 'lib/jsduck/tag/alias.rb', line 17

def parse_doc(p, pos)
  if p.look(/([\w.]+)?#\w+/)
    parse_as_inheritdoc(p)
  else
    parse_as_alias(p)
  end
end

#parse_ext_define(cls, ast) ⇒ Object



37
38
39
# File 'lib/jsduck/tag/alias.rb', line 37

def parse_ext_define(cls, ast)
  cls[:aliases] += JsDuck::Js::Utils.make_string_list(ast)
end

#process_doc(h, tags, pos) ⇒ Object



33
34
35
# File 'lib/jsduck/tag/alias.rb', line 33

def process_doc(h, tags, pos)
  h[:aliases] = tags.map {|tag| tag[:name] }
end