Class: YARD::Tags::Tag
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Inherits: | Object |
| Defined in: | lib/yard/tags/tag.rb |
Overview
Represents a metadata tag value (+@tag+). ::YARD::Tags can have any combination of
#types, #name and #text, or none of the above.
Class Method Summary
-
.new(tag_name, text, types = nil, name = nil) ⇒ Tag
constructor
Creates a new tag object with a tag name and text.
Instance Attribute Summary
Instance Method Summary
-
#explain_types ⇒ String?
Provides a plain English summary of the type specification, or nil if no types are provided or parsable.
-
#type ⇒ String
Convenience method to access the first type specified.
Constructor Details
.new(tag_name, text, types = nil, name = nil) ⇒ Tag
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.
Instance Attribute Details
#name ⇒ String? (rw)
# File 'lib/yard/tags/tag.rb', line 27
attr_accessor :name
#object ⇒ CodeObjects::Base (rw)
# File 'lib/yard/tags/tag.rb', line 30
attr_accessor :object
#tag_name ⇒ String (rw)
# File 'lib/yard/tags/tag.rb', line 15
attr_accessor :tag_name
#text ⇒ String? (rw)
# File 'lib/yard/tags/tag.rb', line 19
attr_accessor :text
#types ⇒ Array<String>? (rw)
# File 'lib/yard/tags/tag.rb', line 23
attr_accessor :types
Instance Method Details
#explain_types ⇒ String?
Provides a plain English summary of the type specification, or nil if no types are provided or parsable.
# File 'lib/yard/tags/tag.rb', line 66
def explain_types return nil if !types || types.empty? TypesExplainer.explain(*types) end
#type ⇒ String
Convenience method to access the first type specified. This should mainly be used for tags that only specify one type.
# File 'lib/yard/tags/tag.rb', line 57
def type types.first end