Class: JsDuck::Tag::Inheritdoc

Inherits:
Tag
  • Object
show all
Defined in:
lib/jsduck/tag/inheritdoc.rb

Direct Known Subclasses

Alias

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

Instance Attribute Summary

Attributes inherited from Tag

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

Instance Method Summary collapse

Methods inherited from Tag

descendants, #format, #parse_ext_define, #to_html

Constructor Details

#initializeInheritdoc

Returns a new instance of Inheritdoc.



6
7
8
9
# File 'lib/jsduck/tag/inheritdoc.rb', line 6

def initialize
  @pattern = ["inheritdoc", "inheritDoc"]
  @tagname = :inheritdoc
end

Instance Method Details

#parse_as_inheritdoc(p) ⇒ Object

This separate method exits to allow it to be also called from Matches a member reference: <class.name> “#” <static> “-” <type> “-” <member>

Returns :inheritdoc tag definition with corresponding fields.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/jsduck/tag/inheritdoc.rb', line 22

def parse_as_inheritdoc(p)
  tag = {
    :tagname => :inheritdoc,
    :cls => p.ident_chain,
  }

  if p.look(/#\w/)
    p.match(/#/)
    if p.look(/static-/)
      tag[:static] = true
      p.match(/static-/)
    end
    if p.look(JsDuck::TagRegistry.member_type_regex)
      tag[:type] = p.match(/\w+/).to_sym
      p.match(/-/)
    end
    tag[:member] = p.ident
  end

  tag
end

#parse_doc(p, pos) ⇒ Object



12
13
14
# File 'lib/jsduck/tag/inheritdoc.rb', line 12

def parse_doc(p, pos)
  parse_as_inheritdoc(p)
end

#process_doc(h, docs, pos) ⇒ Object



44
45
46
# File 'lib/jsduck/tag/inheritdoc.rb', line 44

def process_doc(h, docs, pos)
  h[:inheritdoc] = docs.first
end