Class: Yamlint::Models::Problem
- Inherits:
-
Object
- Object
- Yamlint::Models::Problem
- Defined in:
- lib/yamlint/models/problem.rb
Constant Summary collapse
- LEVELS =
%i[error warning info].freeze
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#fixable ⇒ Object
readonly
Returns the value of attribute fixable.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
- #error? ⇒ Boolean
- #fixable? ⇒ Boolean
-
#initialize(line:, column:, rule:, level:, message:, fixable: false) ⇒ Problem
constructor
A new instance of Problem.
- #to_s ⇒ Object
- #warning? ⇒ Boolean
Constructor Details
#initialize(line:, column:, rule:, level:, message:, fixable: false) ⇒ Problem
Returns a new instance of Problem.
10 11 12 13 14 15 16 17 |
# File 'lib/yamlint/models/problem.rb', line 10 def initialize(line:, column:, rule:, level:, message:, fixable: false) @line = line @column = column @rule = rule @level = validate_level(level) @message = @fixable = fixable end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
6 7 8 |
# File 'lib/yamlint/models/problem.rb', line 6 def column @column end |
#fixable ⇒ Object (readonly)
Returns the value of attribute fixable.
6 7 8 |
# File 'lib/yamlint/models/problem.rb', line 6 def fixable @fixable end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
6 7 8 |
# File 'lib/yamlint/models/problem.rb', line 6 def level @level end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
6 7 8 |
# File 'lib/yamlint/models/problem.rb', line 6 def line @line end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/yamlint/models/problem.rb', line 6 def @message end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
6 7 8 |
# File 'lib/yamlint/models/problem.rb', line 6 def rule @rule end |
Instance Method Details
#error? ⇒ Boolean
19 20 21 |
# File 'lib/yamlint/models/problem.rb', line 19 def error? @level == :error end |
#fixable? ⇒ Boolean
27 28 29 |
# File 'lib/yamlint/models/problem.rb', line 27 def fixable? @fixable end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/yamlint/models/problem.rb', line 31 def to_s "#{line}:#{column} [#{level}] #{} (#{rule})" end |
#warning? ⇒ Boolean
23 24 25 |
# File 'lib/yamlint/models/problem.rb', line 23 def warning? @level == :warning end |