Class: JsDuck::Tag::Fires
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
- #format(m, formatter) ⇒ Object
-
#ident_list(p) ⇒ Object
matches <ident> <ident> …
-
#initialize ⇒ Fires
constructor
A new instance of Fires.
- #parse_doc(p, pos) ⇒ Object
- #process_doc(h, tags, pos) ⇒ Object
- #to_html(m) ⇒ Object
Methods inherited from Tag
descendants, #parse_ext_define
Constructor Details
Instance Method Details
#format(m, formatter) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jsduck/tag/fires.rb', line 31 def format(m, formatter) cls = formatter.relations[m[:owner]] m[:fires] = m[:fires].map do |name| if cls.find_members({:tagname => :event, :name => name}).length > 0 formatter.link(m[:owner], name, name, :event) else JsDuck::Logger.warn(:fires, "@fires references unknown event: #{name}", m[:files][0]) name end end end |
#ident_list(p) ⇒ Object
matches <ident> <ident> … until line end
19 20 21 22 23 24 25 |
# File 'lib/jsduck/tag/fires.rb', line 19 def ident_list(p) list = [] while ident = p.hw.ident list << ident end list end |
#parse_doc(p, pos) ⇒ Object
14 15 16 |
# File 'lib/jsduck/tag/fires.rb', line 14 def parse_doc(p, pos) {:tagname => :fires, :events => ident_list(p)} end |
#process_doc(h, tags, pos) ⇒ Object
27 28 29 |
# File 'lib/jsduck/tag/fires.rb', line 27 def process_doc(h, , pos) h[:fires] = .map {|t| t[:events] }.flatten end |
#to_html(m) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/jsduck/tag/fires.rb', line 44 def to_html(m) return unless m[:fires] && m[:fires].length > 0 return [ "<h3 class='pa'>Fires</h3>", "<ul>", m[:fires].map {|e| "<li>#{e}</li>" }, "</ul>", ] end |