Class: Bones::AnnotationExtractor::Annotation

Inherits:
Struct
  • Object
show all
Defined in:
lib/bones/annotation_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



7
8
9
# File 'lib/bones/annotation_extractor.rb', line 7

def line
  @line
end

#tagObject

Returns the value of attribute tag

Returns:

  • (Object)

    the current value of tag



7
8
9
# File 'lib/bones/annotation_extractor.rb', line 7

def tag
  @tag
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



7
8
9
# File 'lib/bones/annotation_extractor.rb', line 7

def text
  @text
end

Instance Method Details

#to_s(opts = {}) ⇒ Object

Returns a string representation of the annotation. If the :tag parameter is given as true, then the annotation tag will be included in the string.



12
13
14
15
16
# File 'lib/bones/annotation_extractor.rb', line 12

def to_s( opts = {} )
  s = "[#{Bones::Colors.colorize('%3d', :magenta)}] " % line
  s << "[#{Bones::Colors.colorize(tag, :cyan)}] " if opts[:tag]
  s << text
end