Class: ESLintWebpacker::Warning
- Inherits:
-
Object
- Object
- ESLintWebpacker::Warning
- Defined in:
- lib/eslint-webpacker/warning.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#node_type ⇒ Object
readonly
Returns the value of attribute node_type.
Instance Method Summary collapse
-
#initialize(filename, warning_hash) ⇒ Warning
constructor
A new instance of Warning.
- #location ⇒ Object
- #message ⇒ Object
- #rule_id ⇒ Object
- #severity ⇒ Object
Constructor Details
#initialize(filename, warning_hash) ⇒ Warning
Returns a new instance of Warning.
10 11 12 13 14 15 16 17 18 |
# File 'lib/eslint-webpacker/warning.rb', line 10 def initialize(filename, warning_hash) @filename = filename @rule_id = warning_hash['ruleId'] || 'unexpected error' @severity = warning_hash['severity'] @message = warning_hash['message'] @line = warning_hash['line'] @column = warning_hash['column'] @node_type = warning_hash['nodeType'] end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
5 6 7 |
# File 'lib/eslint-webpacker/warning.rb', line 5 def column @column end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/eslint-webpacker/warning.rb', line 5 def filename @filename end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/eslint-webpacker/warning.rb', line 5 def line @line end |
#node_type ⇒ Object (readonly)
Returns the value of attribute node_type.
5 6 7 |
# File 'lib/eslint-webpacker/warning.rb', line 5 def node_type @node_type end |
Instance Method Details
#location ⇒ Object
24 25 26 |
# File 'lib/eslint-webpacker/warning.rb', line 24 def location "#{filename}:#{line}:#{column}" end |
#message ⇒ Object
32 33 34 |
# File 'lib/eslint-webpacker/warning.rb', line 32 def @message || 'N/A' end |
#rule_id ⇒ Object
28 29 30 |
# File 'lib/eslint-webpacker/warning.rb', line 28 def rule_id @rule_id || 'N/A' end |
#severity ⇒ Object
20 21 22 |
# File 'lib/eslint-webpacker/warning.rb', line 20 def severity SEVERITY[@severity - 1] end |