Class: JsDuck::Doc::Processor
- Inherits:
-
Object
- Object
- JsDuck::Doc::Processor
- Defined in:
- lib/jsduck/doc/processor.rb
Overview
Processes @tag data detected from doc-comment, transforming it into a class/member hash which can be then later further merged with code hash.
Its main work is done through calling the #process_doc method of all the Tag classes that have registered themselves to process a particular set of @tags through defining a .tagname attribute.
Instance Attribute Summary collapse
-
#filename ⇒ Object
Allow passing in filename and line for error reporting.
-
#linenr ⇒ Object
Returns the value of attribute linenr.
Instance Method Summary collapse
-
#initialize ⇒ Processor
constructor
A new instance of Processor.
-
#process(tagname, doc_map) ⇒ Object
Given tagname and map of tags from DocParser, produces docs of the type determined by tagname.
Constructor Details
#initialize ⇒ Processor
Returns a new instance of Processor.
18 19 20 21 |
# File 'lib/jsduck/doc/processor.rb', line 18 def initialize @filename = "" @linenr = 0 end |
Instance Attribute Details
#filename ⇒ Object
Allow passing in filename and line for error reporting
15 16 17 |
# File 'lib/jsduck/doc/processor.rb', line 15 def filename @filename end |
#linenr ⇒ Object
Returns the value of attribute linenr.
16 17 18 |
# File 'lib/jsduck/doc/processor.rb', line 16 def linenr @linenr end |
Instance Method Details
#process(tagname, doc_map) ⇒ Object
Given tagname and map of tags from DocParser, produces docs of the type determined by tagname.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/jsduck/doc/processor.rb', line 25 def process(tagname, doc_map) hash = { :tagname => tagname, :doc => extract_doc(doc_map), } position = {:filename => @filename, :linenr => @linenr} doc_map.each_pair do |name, value| if tag = TagRegistry.get_by_name(name) tag.process_doc(hash, value, position) end end return hash end |