Class: Tap::Declarations::Description

Inherits:
Lazydoc::Comment
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#descObject

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_sObject

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