Class: JsDuck::DocAst

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/doc_ast.rb

Overview

Detects docs info directly from comment.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocAst

Returns a new instance of DocAst.



12
13
14
15
16
# File 'lib/jsduck/doc_ast.rb', line 12

def initialize
  @filename = ""
  @linenr = 0
  @meta_tags = MetaTagRegistry.instance
end

Instance Attribute Details

#filenameObject

Allow passing in filename and line for error reporting



9
10
11
# File 'lib/jsduck/doc_ast.rb', line 9

def filename
  @filename
end

#linenrObject

Returns the value of attribute linenr.



10
11
12
# File 'lib/jsduck/doc_ast.rb', line 10

def linenr
  @linenr
end

Instance Method Details

#detect(tagname, docs) ⇒ Object

Given tagname and array of tags from DocParser, produces docs of the type determined by tagname.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jsduck/doc_ast.rb', line 20

def detect(tagname, docs)
  case tagname
  when :class
    create_class(docs)
  when :event
    create_event(docs)
  when :method
    create_method(docs)
  when :cfg
    create_cfg(docs)
  when :property
    create_property(docs)
  when :css_var
    create_css_var(docs)
  when :css_mixin
    create_css_mixin(docs)
  end
end