Class: Languages::Comment Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/kuniri/language/abstract_container/structured_and_oo/comment.rb

Overview

This class is abstract.

Class responsible for handling comments. Attention, this class

is the only exception to the pattern. Usually, we implements a method called detect_something. However, in the case of comment, it is easier to create another set of methods.

Direct Known Subclasses

Ruby::CommentRuby

Instance Method Summary collapse

Instance Method Details

#get_comment(pLine) ⇒ Object

This method is responsible for handling comments.

Parameters:

  • pLine

    String to be analysed.

Returns:

  • Returns nil if doesn't find any comment line, or returns a string with comments. Finally, if it find the final of multiple line comment it returns END_MULTIPLE_LINE_COMMENT.

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/kuniri/language/abstract_container/structured_and_oo/comment.rb', line 16

def get_comment(pLine)
  raise NotImplementedError
end

#is_multiple_line_comment?(pLine) ⇒ Boolean

This method verify if it a multiple line comment.

Parameters:

  • pLine

    String for verify if is a multiple line comment.

Returns:

  • (Boolean)

    Return true if is a multiple line comment, otherwise, return false.

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/kuniri/language/abstract_container/structured_and_oo/comment.rb', line 32

def is_multiple_line_comment?(pLine)
  raise NotImplementedError
end

#is_multiple_line_comment_end?(pLine) ⇒ Boolean

This method verify if it is the end of multiple line comment.

Parameters:

  • pLine

    String to be inspected.

Returns:

  • (Boolean)

    Return true if is the end of multiple line comment, otherwise, return true.

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/kuniri/language/abstract_container/structured_and_oo/comment.rb', line 40

def is_multiple_line_comment_end?(pLine)
  raise NotImplementedError
end

#is_single_line_comment?(pLine) ⇒ Boolean

This method is responsible for checking if is a single line comment.

Parameters:

  • pLine

    String for verify if is a single line comment.

Returns:

  • (Boolean)

    Return true if is a single line comment, otherwise, return false.

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/kuniri/language/abstract_container/structured_and_oo/comment.rb', line 24

def is_single_line_comment?(pLine)
  raise NotImplementedError
end

#prepare_line_comment(pString) ⇒ Object (protected)

Method responsible for doing the final adjustment in the comment.

Parameters:

  • pString

    Comment string to be handled.

Returns:

  • Return a string.

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/kuniri/language/abstract_container/structured_and_oo/comment.rb', line 49

def prepare_line_comment(pString)
  raise NotImplementedError
end