Sha256: 509613910e0e55c49d74e564d077cf086af5135fb366ffd9177cd67cf02fd932
Contents?: true
Size: 1.3 KB
Versions: 30
Compression:
Stored size: 1.3 KB
Contents
require 'jsduck/tag_registry' module JsDuck module Doc # 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. class Processor # Allow passing in filename and line for error reporting attr_accessor :filename attr_accessor :linenr def initialize @filename = "" @linenr = 0 end # Given tagname and map of tags from DocParser, produces docs # of the type determined by tagname. 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 private def extract_doc(doc_map) tag = doc_map[:doc] ? doc_map[:doc].first : {} return tag[:doc] || "" end end end end
Version data entries
30 entries across 30 versions & 3 rubygems