Class: JsDuck::Tag::Return

Inherits:
Tag
  • Object
show all
Defined in:
lib/jsduck/tag/return.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

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, #parse_ext_define

Constructor Details

#initializeReturn

Returns a new instance of Return.



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

def initialize
  @pattern = ["return", "returns"]
  @tagname = :return
  @repeatable = true
  @html_position = POS_RETURN
end

Instance Method Details

#format(m, formatter) ⇒ Object



40
41
42
# File 'lib/jsduck/tag/return.rb', line 40

def format(m, formatter)
  formatter.format_subproperty(m[:return])
end

#parse_doc(p, pos) ⇒ Type

Return.name …

Returns:

  • (Type)

    return.name …



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

def parse_doc(p, pos)
  tag = p.standard_tag({:tagname => :return, :type => true})
  tag[:name] = subproperty_name(p)
  tag[:doc] = :multiline
  tag
end

#process_doc(h, tags, pos) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/jsduck/tag/return.rb', line 30

def process_doc(h, tags, pos)
  ret = tags[0]
  h[:return] = {
    :type => ret[:type] || "Object",
    :name => ret[:name] || "return",
    :doc => ret[:doc] || "",
    :properties => JsDuck::Doc::Subproperties.nest(tags, pos)[0][:properties],
  }
end

#subproperty_name(p) ⇒ Object



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

def subproperty_name(p)
  if p.hw.look(/return\.\w/)
    p.ident_chain
  else
    "return"
  end
end

#to_html(m) ⇒ Object



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

def to_html(m)
  JsDuck::Render::Subproperties.render_return(m[:return])
end