Class: Tap::Declarations::Description
- Inherits:
-
Lazydoc::Comment
- Object
- Lazydoc::Comment
- Tap::Declarations::Description
- Defined in:
- lib/tap/declarations/description.rb
Overview
:startdoc:::- A special type of Lazydoc::Comment designed to handle the comment syntax for task declarations.
Description instances can be assigned a description, or they may parse one directly from the comment. Comment lines with the constant attribute ‘::’ will have the value set as desc. :startdoc:::+
Instance Attribute Summary collapse
-
#desc ⇒ Object
The description for self.
Instance Method Summary collapse
-
#prepend(line) ⇒ Object
Parses in-comment descriptions from prepended lines, if present.
-
#to_s ⇒ Object
Resolves and returns the description.
Instance Attribute Details
#desc ⇒ Object
The description for self.
14 15 16 |
# File 'lib/tap/declarations/description.rb', line 14 def desc @desc end |
Instance Method Details
#prepend(line) ⇒ Object
Parses in-comment descriptions from prepended lines, if present.
17 18 19 20 21 22 23 24 |
# File 'lib/tap/declarations/description.rb', line 17 def prepend(line) if line =~ /\s::(?:\s+(.*?)\s*)?$/ self.desc = $1.to_s false else super end end |
#to_s ⇒ Object
Resolves and returns the description.
27 28 29 30 |
# File 'lib/tap/declarations/description.rb', line 27 def to_s resolve desc.to_s end |