Class: YARD::Tags::Tag
- Inherits:
-
Object
- Object
- YARD::Tags::Tag
- Defined in:
- lib/yard/tags/tag.rb
Overview
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (String) name
A name associated with the tag.
-
- (CodeObjects::Base) object
The associated object.
-
- (String) tag_name
The name of the tag.
- - (String?) text
- - (Array<String>?) types
Instance Method Summary (collapse)
-
- (Tag) initialize(tag_name, text, types = nil, name = nil)
constructor
Creates a new tag object with a tag name and text.
-
- (String) type
Convenience method to access the first type specified.
Constructor Details
- (Tag) 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.
43 44 45 |
# File 'lib/yard/tags/tag.rb', line 43 def initialize(tag_name, text, types = nil, name = nil) @tag_name, @text, @name, @types = tag_name.to_s, text, name, (types ? [types].flatten.compact : nil) end |
Instance Attribute Details
- (String) name
Returns a name associated with the tag
25 26 27 |
# File 'lib/yard/tags/tag.rb', line 25 def name @name end |
- (CodeObjects::Base) object
Returns the associated object
28 29 30 |
# File 'lib/yard/tags/tag.rb', line 28 def object @object end |
- (String) tag_name
Returns the name of the tag
14 15 16 |
# File 'lib/yard/tags/tag.rb', line 14 def tag_name @tag_name end |
Instance Method Details
- (String) type
Convenience method to access the first type specified. This should mainly be used for tags that only specify one type.
52 53 54 |
# File 'lib/yard/tags/tag.rb', line 52 def type types.first end |