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 |
# File 'lib/rubocop/error.rb', line 14 def initialize(cause:, node:, cop:) @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.
20 21 22 |
# File 'lib/rubocop/error.rb', line 20 def cause @cause end |
#cop ⇒ Object (readonly)
Returns the value of attribute cop.
20 21 22 |
# File 'lib/rubocop/error.rb', line 20 def cop @cop end |
Instance Method Details
#column ⇒ Object
26 27 28 |
# File 'lib/rubocop/error.rb', line 26 def column @location&.column end |
#line ⇒ Object
22 23 24 |
# File 'lib/rubocop/error.rb', line 22 def line @location&.line end |
#message ⇒ Object
30 31 32 |
# File 'lib/rubocop/error.rb', line 30 def "cause: #{cause.inspect}" end |