Sha256: a7290e33d095da51f32bb1cb809f1c7d284a874a28557ce78e4d175faa797a6b

Contents?: true

Size: 976 Bytes

Versions: 28

Compression:

Stored size: 976 Bytes

Contents

require "jsduck/tag/inheritdoc"
require "jsduck/js/utils"

module JsDuck::Tag
  class Alias < Inheritdoc
    def initialize
      @pattern = "alias"
      @tagname = :aliases
      @repeatable = true
      @ext_define_pattern = "alias"
      @ext_define_default = {:aliases => []}
    end

    # For backwards compatibility decide whether the @alias was used
    # as @inheritdoc (@alias used to have the meaning of @inheritdoc
    # before) or as a real Ext4 style alias definition.
    def parse_doc(p, pos)
      if p.look(/([\w.]+)?#\w+/)
        parse_as_inheritdoc(p)
      else
        parse_as_alias(p)
      end
    end

    # @alias widget.foo
    def parse_as_alias(p)
      {
        :tagname => :aliases,
        :name => p.ident_chain,
      }
    end

    def process_doc(h, tags, pos)
      h[:aliases] = tags.map {|tag| tag[:name] }
    end

    def parse_ext_define(cls, ast)
      cls[:aliases] += JsDuck::Js::Utils.make_string_list(ast)
    end

  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
jsduck-5.3.0 lib/jsduck/tag/alias.rb
jsduck-5.2.0 lib/jsduck/tag/alias.rb
jsduck-5.1.0 lib/jsduck/tag/alias.rb
jsduck-5.0.1 lib/jsduck/tag/alias.rb
jsduck-5.0.0 lib/jsduck/tag/alias.rb
jsduck-5.0.0.beta5 lib/jsduck/tag/alias.rb
jsduck-5.0.0.beta4 lib/jsduck/tag/alias.rb
jsduck-5.0.0.beta3 lib/jsduck/tag/alias.rb