Exception: RuboCop::ErrorWithAnalyzedFileLocation
- Defined in:
- lib/rubocop/error.rb
Overview
A wrapper to display errored location of analyzed file.
Instance Attribute Summary collapse
-
#cause ⇒ Object
readonly
Returns the value of attribute cause.
-
#cop ⇒ Object
readonly
Returns the value of attribute cop.
Instance Method Summary collapse
- #column ⇒ Object
-
#initialize(cause:, node:, cop:) ⇒ ErrorWithAnalyzedFileLocation
constructor
A new instance of ErrorWithAnalyzedFileLocation.
- #line ⇒ Object
- #message ⇒ Object
Constructor Details
#initialize(cause:, node:, cop:) ⇒ ErrorWithAnalyzedFileLocation
Returns a new instance of ErrorWithAnalyzedFileLocation.
14 15 16 17 18 19 |
# File 'lib/rubocop/error.rb', line 14 def initialize(cause:, node:, cop:) super() @cause = cause @cop = cop @location = node.is_a?(RuboCop::AST::Node) ? node.loc : node end |
Instance Attribute Details
#cause ⇒ Object (readonly)
Returns the value of attribute cause.
21 22 23 |
# File 'lib/rubocop/error.rb', line 21 def cause @cause end |
#cop ⇒ Object (readonly)
Returns the value of attribute cop.
21 22 23 |
# File 'lib/rubocop/error.rb', line 21 def cop @cop end |
Instance Method Details
#column ⇒ Object
27 28 29 |
# File 'lib/rubocop/error.rb', line 27 def column @location&.column end |
#line ⇒ Object
23 24 25 |
# File 'lib/rubocop/error.rb', line 23 def line @location&.line end |
#message ⇒ Object
31 32 33 |
# File 'lib/rubocop/error.rb', line 31 def "cause: #{cause.inspect}" end |