class YARD::Tags::Tag
Tag.new(:param, ‘an argument’, [‘String’, ‘nil’], ‘arg’)
# is equivalent to:
#
# @param [String, nil] arg an argument
# The following docstring syntax:
@example Programmatic tag creation
{#types}, {#name} and {#text}, or none of the above.
Represents a metadata tag value (+@tag+). Tags can have any combination of
def explain_types
-
(nil)
- if no types are provided or not parseable -
(String)
- a plain English description of the associated types
def explain_types return nil if !types || types.empty? TypesExplainer.explain(*types) end
def initialize(tag_name, text, types = nil, name = nil)
-
name
(String
) -- optional key name which the tag refers to -
types
(Array
) -- optional type list of formally declared types -
text
(String
) -- the descriptive text for this tag -
tag_name
(#to_s
) -- the tag name to create the tag for
def initialize(tag_name, text, types = nil, name = nil) @tag_name = tag_name.to_s @text = text @name = name @types = (types ? [types].flatten.compact : nil) end
def type
- See: #types -
Returns:
-
(String)
- the first of the list of specified types
def type types.first end