Class: RuboCop::CommentConfig::ConfigDisabledCopDirectiveComment

Inherits:
Object
  • Object
show all
Includes:
Ext::Comment
Defined in:
lib/rubocop/comment_config.rb

Overview

This class provides an API compatible with RuboCop::DirectiveComment to be used for cops that are disabled in the config file

Defined Under Namespace

Classes: Expression, Loc

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Ext::Comment

#source, #source_range

Constructor Details

#initialize(cop_name) ⇒ ConfigDisabledCopDirectiveComment

Returns a new instance of ConfigDisabledCopDirectiveComment.



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

def initialize(cop_name)
  @text = "# rubocop:disable #{cop_name}"
  @line_number = CONFIG_DISABLED_LINE_RANGE_MIN
  @loc = Loc.new(Expression.new(CONFIG_DISABLED_LINE_RANGE_MIN))
end

Instance Attribute Details

#line_numberObject (readonly)

Returns the value of attribute line_number.



16
17
18
# File 'lib/rubocop/comment_config.rb', line 16

def line_number
  @line_number
end

#locObject (readonly)

Returns the value of attribute loc.



16
17
18
# File 'lib/rubocop/comment_config.rb', line 16

def loc
  @loc
end

#textObject (readonly)

Returns the value of attribute text.



16
17
18
# File 'lib/rubocop/comment_config.rb', line 16

def text
  @text
end