Class YARD::Tag

Object
  |
  +--YARD::Tag

Attributes

name [R]
tag_name [R]
text [R]
types [R]

Constructor Summary

initialize(tag_name, text, types = nil, name = nil)

Creates a new tag object with a tag name and text. Optionally, formally declared types and a key name can be specified.

Types are mainly for meta tags that rely on type information, such as param, return, etc.

Key names are for tags that declare meta data for a specific key or name, such as param, raise, etc.

Parameters:
tag_name - the tag name to create the tag for
[String] text - the descriptive text for this tag
[Array] types - optional type list of formally declared types for the tag
[String] name - optional key name which the tag refers to

Public Class Method Summary

Array extract_name_from_text(text)
      Extracts the name from raw tag text returning the name and remaining value .
Array extract_types_from_text(text)
      Extracts the type signatures from the raw tag text .
Tag parse_tag(tag_name, text)
      Parses tag text and creates a new tag with descriptive text .
Tag parse_tag_with_name(tag_name, text)
      Parses tag text and creates a new tag with a key name and descriptive text .
Tag parse_tag_with_types(tag_name, text)
      Parses tag text and creates a new tag with formally declared types and .
Tag parse_tag_with_types_and_name(tag_name, text)
      Parses tag text and creates a new tag with formally declared types, a key .

Public Instance Method Summary

Object name
      Returns the value of attribute name .
Object name=(value)
      Sets the attribute name .
Object tag_name
      Returns the value of attribute tag_name .
Object tag_name=(value)
      Sets the attribute tag_name .
Object text
      Returns the value of attribute text .
Object text=(value)
      Sets the attribute text .
type
      Convenience method to access the first type specified .
Object types
      Returns the value of attribute types .
Object types=(value)
      Sets the attribute types .

Public Class Method Details

extract_name_from_text

public Array extract_name_from_text(text)

Extracts the name from raw tag text returning the name and remaining value

Parameters:
[String] text - the raw tag text
Returns:
an array holding the name as the first element and the value as the second element

extract_types_from_text

public Array extract_types_from_text(text)

Extracts the type signatures from the raw tag text

Parameters:
[String] text - the raw tag text
Returns:
an array holding the value as the first element and the array of types as the second element

parse_tag

public Tag parse_tag(tag_name, text)

Parses tag text and creates a new tag with descriptive text

Parameters:
tag_name - the name of the tag to parse
[String] text - the raw tag text
Returns:
a tag object with the tag_name and text values filled

parse_tag_with_name

public Tag parse_tag_with_name(tag_name, text)

Parses tag text and creates a new tag with a key name and descriptive text

Parameters:
tag_name - the name of the tag to parse
[String] text - the raw tag text
Returns:
a tag object with the tag_name, name and text values filled

parse_tag_with_types

public Tag parse_tag_with_types(tag_name, text)

Parses tag text and creates a new tag with formally declared types and descriptive text

Parameters:
tag_name - the name of the tag to parse
[String] text - the raw tag text
Returns:
a tag object with the tag_name, types and text values filled

parse_tag_with_types_and_name

public Tag parse_tag_with_types_and_name(tag_name, text)

Parses tag text and creates a new tag with formally declared types, a key name and descriptive text

Parameters:
tag_name - the name of the tag to parse
[String] text - the raw tag text
Returns:
a tag object with the tag_name, name, types and text values filled

Public Instance Method Details

name

public Object name

Returns the value of attribute name


name=

public Object name=(value)

Sets the attribute name

Parameters:
value - the value to set the attribute name to.

tag_name

public Object tag_name

Returns the value of attribute tag_name


tag_name=

public Object tag_name=(value)

Sets the attribute tag_name

Parameters:
value - the value to set the attribute tag_name to.

text

public Object text

Returns the value of attribute text


text=

public Object text=(value)

Sets the attribute text

Parameters:
value - the value to set the attribute text to.

type

public Object type

Convenience method to access the first type specified. This should mainly be used for tags that only specify one type.

Returns:
(String) the first of the list of specified types
See Also:
#types

types

public Object types

Returns the value of attribute types


types=

public Object types=(value)

Sets the attribute types

Parameters:
value - the value to set the attribute types to.