Class: JsDuck::Tag::Throws

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

Constant Summary

Constants inherited from Tag

JsDuck::Tag::Tag::POS_ASIDE, JsDuck::Tag::Tag::POS_DEFAULT, JsDuck::Tag::Tag::POS_DEPRECATED, JsDuck::Tag::Tag::POS_DOC, JsDuck::Tag::Tag::POS_ENUM, JsDuck::Tag::Tag::POS_FIRES, JsDuck::Tag::Tag::POS_LOCALDOC, JsDuck::Tag::Tag::POS_OVERRIDES, JsDuck::Tag::Tag::POS_PARAM, JsDuck::Tag::Tag::POS_PREVENTABLE, JsDuck::Tag::Tag::POS_PRIVATE, JsDuck::Tag::Tag::POS_RETURN, JsDuck::Tag::Tag::POS_SINCE, JsDuck::Tag::Tag::POS_SUBPROPERTIES, JsDuck::Tag::Tag::POS_TEMPLATE, JsDuck::Tag::Tag::POS_THROWS, JsDuck::Tag::Tag::PRIORITY_CLASS, JsDuck::Tag::Tag::PRIORITY_COMPONENT, JsDuck::Tag::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 Tag

descendants, #parse_ext_define

Constructor Details

#initializeThrows

Returns a new instance of Throws.



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

def initialize
  @pattern = "throws"
  @tagname = :throws
  @repeatable = true
  @html_position = POS_THROWS
end

Instance Method Details

#format(m, formatter) ⇒ Object



31
32
33
# File 'lib/jsduck/tag/throws.rb', line 31

def format(m, formatter)
  m[:throws].each {|t| formatter.format_subproperty(t) }
end

#parse_doc(p, pos) ⇒ Object



14
15
16
17
18
# File 'lib/jsduck/tag/throws.rb', line 14

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

#process_doc(h, tags, pos) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/jsduck/tag/throws.rb', line 20

def process_doc(h, tags, pos)
  result = tags.map do |throws|
    {
      :type => throws[:type] || "Object",
      :doc => throws[:doc] || "",
    }
  end

  h[:throws] = result
end

#to_html(m) ⇒ Object



35
36
37
# File 'lib/jsduck/tag/throws.rb', line 35

def to_html(m)
  JsDuck::Render::Subproperties.render_throws(m[:throws])
end