Class: HamlLint::Lint
- Inherits:
-
Object
- Object
- HamlLint::Lint
- Defined in:
- lib/haml_lint/lint.rb
Overview
Contains information about a problem or issue with a HAML document.
Instance Attribute Summary collapse
-
#filename ⇒ String
readonly
File path to which the lint applies.
-
#line ⇒ String
readonly
Line number of the file the lint corresponds to.
-
#linter ⇒ SlimLint::Linter
readonly
Linter that reported the lint.
-
#message ⇒ String
readonly
Error/warning message to display to user.
-
#severity ⇒ Symbol
readonly
Whether this lint is a warning or an error.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Return whether this lint has a severity of error.
-
#initialize(linter, filename, line, message, severity = :warning) ⇒ Lint
constructor
Creates a new lint.
Constructor Details
#initialize(linter, filename, line, message, severity = :warning) ⇒ Lint
Creates a new lint.
26 27 28 29 30 31 32 |
# File 'lib/haml_lint/lint.rb', line 26 def initialize(linter, filename, line, , severity = :warning) @linter = linter @filename = filename @line = line || 0 @message = @severity = severity end |
Instance Attribute Details
#filename ⇒ String (readonly)
Returns file path to which the lint applies.
5 6 7 |
# File 'lib/haml_lint/lint.rb', line 5 def filename @filename end |
#line ⇒ String (readonly)
Returns line number of the file the lint corresponds to.
8 9 10 |
# File 'lib/haml_lint/lint.rb', line 8 def line @line end |
#linter ⇒ SlimLint::Linter (readonly)
Returns linter that reported the lint.
11 12 13 |
# File 'lib/haml_lint/lint.rb', line 11 def linter @linter end |
#message ⇒ String (readonly)
Returns error/warning message to display to user.
14 15 16 |
# File 'lib/haml_lint/lint.rb', line 14 def @message end |
#severity ⇒ Symbol (readonly)
Returns whether this lint is a warning or an error.
17 18 19 |
# File 'lib/haml_lint/lint.rb', line 17 def severity @severity end |
Instance Method Details
#error? ⇒ Boolean
Return whether this lint has a severity of error.
37 38 39 |
# File 'lib/haml_lint/lint.rb', line 37 def error? @severity == :error end |