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

Version Path
solvas-jsduck-6.0.0.30539 lib/jsduck/doc/processor.rb
solvas-jsduck-6.0.0.9571 lib/jsduck/doc/processor.rb
solvas-jsduck-6.0.0.6154 lib/jsduck/doc/processor.rb
solvas-jsduck-6.0.0.4021 lib/jsduck/doc/processor.rb
solvas-jsduck-6.0.0.2554 lib/jsduck/doc/processor.rb
solvas-jsduck-6.0.0.1891 lib/jsduck/doc/processor.rb
solvas-jsduck-6.0.0.beta.1888 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.10 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.9 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.8 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.7 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.5 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.4 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.3 lib/jsduck/doc/processor.rb
jsduck-troopjs-0.0.1 lib/jsduck/doc/processor.rb
jsduck-6.0.0beta lib/jsduck/doc/processor.rb
jsduck-5.3.4 lib/jsduck/doc/processor.rb
jsduck-5.3.3 lib/jsduck/doc/processor.rb
jsduck-5.3.2 lib/jsduck/doc/processor.rb
jsduck-5.3.1 lib/jsduck/doc/processor.rb