Class: RuboCop::CommentConfig::CopAnalysis Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubocop/comment_config/directive_range.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

The per-cop state accumulated while analyzing directives: the disabled ranges so far, plus the line and directive of the currently open disable, if any.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#line_rangesObject

Returns the value of attribute line_ranges

Returns:

  • (Object)

    the current value of line_ranges



22
23
24
# File 'lib/rubocop/comment_config/directive_range.rb', line 22

def line_ranges
  @line_ranges
end

#start_directiveObject

Returns the value of attribute start_directive

Returns:

  • (Object)

    the current value of start_directive



22
23
24
# File 'lib/rubocop/comment_config/directive_range.rb', line 22

def start_directive
  @start_directive
end

#start_line_numberObject

Returns the value of attribute start_line_number

Returns:

  • (Object)

    the current value of start_line_number



22
23
24
# File 'lib/rubocop/comment_config/directive_range.rb', line 22

def start_line_number
  @start_line_number
end

Instance Method Details

#close(line) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The open range (if any) closed at the given line, appended to the accumulated ranges, each remembering the directive that opened it.



25
26
27
28
29
# File 'lib/rubocop/comment_config/directive_range.rb', line 25

def close(line)
  return line_ranges unless start_line_number

  line_ranges + [DirectiveRange.new(start_line_number, line, start_directive)]
end