class JsDuck::MemberRegistry

Access to member tags

Public Class Methods

definitions() click to toggle source

Returns array of available member type definitions. Sorted in the order defined by :position.

# File lib/jsduck/member_registry.rb, line 15
def definitions
  if !@definitions
    @definitions = TagRegistry.tags.find_all do |tag|
      tag.respond_to?(:member_type) && tag.member_type
    end.map do |tag|
      cfg = tag.member_type
      cfg[:name] = tag.tagname
      cfg
    end
    @definitions.sort! {|a, b| a[:position] <=> b[:position] }
  end

  @definitions
end
names() click to toggle source

Same as definitions, but returns just the names of member types.

# File lib/jsduck/member_registry.rb, line 9
def names
  definitions.map {|mt| mt[:name] }
end
regex() click to toggle source

Regex for matching member type name in member reference.

The regex matches strings like: “method-” or “event-”. It contains a capture group to capture the actual name of the member, leaving out the dash “-”.

# File lib/jsduck/member_registry.rb, line 35
def regex
  @regex ||= Regexp.new("(?:(" + names.join("|") + ")-)")
end