Method: JsDuck::BaseType.detect

Defined in:
lib/jsduck/base_type.rb

.detect(doc_map, code) ⇒ Object

Given parsed documentation and code, returns the tagname for documentation item.

Parameters:

  • doc_map

    Result from DocParser turned into hash of tags.

  • code

    Result from Ast#detect or CssParser#parse



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jsduck/base_type.rb', line 14

def self.detect(doc_map, code)
  if doc_map[:class] || doc_map[:override]
    :class
  elsif type = detect_member(doc_map)
    type
  elsif doc_map[:type]
    # @type also results in property
    :property
  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[:params] || doc_map[:return]
    :method
  else
    code[:tagname]
  end
end