123456789_123456789_123456789_123456789_123456789_

Class: RuboCop::CommentConfig::CopAnalysis Private

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/rubocop/comment_config/directive_range.rb

Overview

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

  • #line_ranges rw Internal use only

    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.

  • #start_directive rw Internal use only

    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.

  • #start_line_number rw Internal use only

    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 Method Summary

  • #close(line) Internal use only

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

Instance Attribute Details

#line_ranges (rw)

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.

[ GitHub ]

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

CopAnalysis = Struct.new(:line_ranges, :start_line_number, :start_directive)

#start_directive (rw)

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.

[ GitHub ]

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

CopAnalysis = Struct.new(:line_ranges, :start_line_number, :start_directive)

#start_line_number (rw)

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.

[ GitHub ]

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

CopAnalysis = Struct.new(:line_ranges, :start_line_number, :start_directive)

Instance Method Details

#close(line)

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

[ GitHub ]

  
# 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