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, 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
- #format(m, formatter) ⇒ Object
-
#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
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/jsduck/tag/fires.rb', line 45 def format(m, formatter) m[:fires] = m[:fires].map do |f| member = f[:member]; owner = f[:cls] || m[:owner] # Check event existence. cls = formatter.relations[owner] if cls.find_members({:tagname => :event, :name => member}).length > 0 formatter.link(owner, member, member, :event, m[:static]) else JsDuck::Logger.warn(:fires, "@fires unknown event: #{label}", m[:files][0]) end end end |
#parse_doc(p, pos) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/jsduck/tag/fires.rb', line 14 def parse_doc(p, pos) tag = {:tagname => :fires} # event name from other class if p.look(/.+#/) tag[:cls] = p.ident_chain p.match(/#/) if p.look(/static-/) tag[:static] = true p.match(/static-/) end if p.look(JsDuck::MemberRegistry.regex) tag[:type] = p.match(/\w+/).to_sym p.match(/-/) end tag[:member] = p.ident # event name from own class else tag[:cls] = nil tag[:type] = :event tag[:member] = p.ident end tag end |
#process_doc(h, tags, pos) ⇒ Object
40 41 42 43 |
# File 'lib/jsduck/tag/fires.rb', line 40 def process_doc(h, , pos) h[:fires] = .select {|t| t[:tagname] == :fires } h end |
#to_html(m) ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/jsduck/tag/fires.rb', line 60 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 |