class JsDuck::Tag::Type

Public Class Methods

new() click to toggle source
# File lib/jsduck/tag/type.rb, line 5
def initialize
  @pattern = "type"
  @tagname = :type

  # We don't really care about the position as we don't output any
  # HTML. We just need to set this up to do the formatting.
  @html_position = POS_DOC
end

Public Instance Methods

curlyless_type(p) click to toggle source
# File lib/jsduck/tag/type.rb, line 25
def curlyless_type(p)
  p.match(/\S+/)
end
format(m, formatter) click to toggle source
# File lib/jsduck/tag/type.rb, line 33
def format(m, formatter)
  m[:html_type] = formatter.format_type(m[:type])
end
parse_doc(p, pos) click to toggle source

matches @type {type} or @type type

The presence of @type implies that we are dealing with property. ext-doc allows type name to be either inside curly braces or without them at all.

# File lib/jsduck/tag/type.rb, line 19
def parse_doc(p, pos)
  tag = p.standard_tag({:tagname => :type, :type => true, :optional => true})
  tag[:type] = curlyless_type(p) unless tag[:type]
  tag
end
process_doc(h, tags, pos) click to toggle source
# File lib/jsduck/tag/type.rb, line 29
def process_doc(h, tags, pos)
  h[:type] = tags[0][:type] unless h[:type]
end