Class: Rake::Notes::SourceAnnotationExtractor::Annotation
- Inherits:
-
Struct
- Object
- Struct
- Rake::Notes::SourceAnnotationExtractor::Annotation
- Defined in:
- lib/rake/notes/source_annotation_extractor.rb
Constant Summary collapse
- COLORS =
{ 'OPTIMIZE' => 'cyan', 'FIXME' => 'red', 'TODO' => 'yellow' }
Instance Attribute Summary collapse
-
#line ⇒ Object
Returns the value of attribute line.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#to_s(options = {}) ⇒ Object
Returns a representation of the annotation that looks like this:.
Instance Attribute Details
#line ⇒ Object
Returns the value of attribute line
37 38 39 |
# File 'lib/rake/notes/source_annotation_extractor.rb', line 37 def line @line end |
#tag ⇒ Object
Returns the value of attribute tag
37 38 39 |
# File 'lib/rake/notes/source_annotation_extractor.rb', line 37 def tag @tag end |
#text ⇒ Object
Returns the value of attribute text
37 38 39 |
# File 'lib/rake/notes/source_annotation_extractor.rb', line 37 def text @text end |
Instance Method Details
#to_s(options = {}) ⇒ Object
Returns a representation of the annotation that looks like this:
[126] [TODO] This algorithm is simple and clearly correct, make it faster.
If options
has a flag :tag
the tag is shown as in the example above. Otherwise the string contains just line and text.
50 51 52 53 54 55 |
# File 'lib/rake/notes/source_annotation_extractor.rb', line 50 def to_s(={}) colored_tag = COLORS[tag.to_s].nil? ? tag : tag.send(COLORS[tag.to_s]) s = "[#{line.to_s.rjust([:indent]).green}] " s << "[#{colored_tag}] " if [:tag] s << text end |