Sha256: 4ea074e786d79c5cd7171a97033578a2257e37303baf6b354be47ded0431d9ed

Contents?: true

Size: 1.08 KB

Versions: 29

Compression:

Stored size: 1.08 KB

Contents

require "jsduck/tag/tag"
require "jsduck/doc/subproperties"
require "jsduck/render/subproperties"

module JsDuck::Tag
  class Return < Tag
    def initialize
      @pattern = ["return", "returns"]
      @tagname = :return
      @repeatable = true
      @html_position = POS_RETURN
    end

    # @return {Type} return.name ...
    def parse_doc(p, pos)
      tag = p.standard_tag({:tagname => :return, :type => true})
      tag[:name] = subproperty_name(p)
      tag[:doc] = :multiline
      tag
    end

    def subproperty_name(p)
      if p.hw.look(/return\.\w/)
        p.ident_chain
      else
        "return"
      end
    end

    def process_doc(h, tags, pos)
      ret = tags[0]
      h[:return] = {
        :type => ret[:type] || "Object",
        :name => ret[:name] || "return",
        :doc => ret[:doc] || "",
        :properties => JsDuck::Doc::Subproperties.nest(tags, pos)[0][:properties],
      }
    end

    def format(m, formatter)
      formatter.format_subproperty(m[:return])
    end

    def to_html(m)
      JsDuck::Render::Subproperties.render_return(m[:return])
    end
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

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