Class: JsDuck::DocType
- Inherits:
-
Object
- Object
- JsDuck::DocType
- Defined in:
- lib/jsduck/doc_type.rb
Overview
Detects the type of documentation object: class, method, cfg, etc
Instance Method Summary collapse
-
#detect(docs, code) ⇒ Object
Given parsed documentation and code, returns the tagname for documentation item.
Instance Method Details
#detect(docs, code) ⇒ Object
Given parsed documentation and code, returns the tagname for documentation item.
12 13 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 39 40 41 |
# File 'lib/jsduck/doc_type.rb', line 12 def detect(docs, code) doc_map = build_doc_map(docs) if doc_map[:class] || doc_map[:override] :class elsif doc_map[:event] :event elsif doc_map[:method] :method elsif doc_map[:property] || doc_map[:type] :property elsif doc_map[:css_var] :css_var elsif doc_map[:cfg] && doc_map[:cfg].length == 1 # When just one @cfg, avoid treating it as @class :cfg elsif code[:tagname] == :class :class elsif code[:tagname] == :css_mixin :css_mixin elsif doc_map[:cfg] :cfg elsif doc_map[:constructor] :method elsif doc_map[:param] || doc_map[:return] :method else code[:tagname] end end |