Class: ESLintRails::Warning
- Inherits:
-
Object
- Object
- ESLintRails::Warning
- Defined in:
- lib/eslint-rails-ee/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.
8 9 10 11 12 13 14 15 16 |
# File 'lib/eslint-rails-ee/warning.rb', line 8 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.
3 4 5 |
# File 'lib/eslint-rails-ee/warning.rb', line 3 def column @column end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
3 4 5 |
# File 'lib/eslint-rails-ee/warning.rb', line 3 def filename @filename end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
3 4 5 |
# File 'lib/eslint-rails-ee/warning.rb', line 3 def line @line end |
#node_type ⇒ Object (readonly)
Returns the value of attribute node_type.
3 4 5 |
# File 'lib/eslint-rails-ee/warning.rb', line 3 def node_type @node_type end |
Instance Method Details
#location ⇒ Object
22 23 24 |
# File 'lib/eslint-rails-ee/warning.rb', line 22 def location "#{filename}:#{line}:#{column}" end |
#message ⇒ Object
30 31 32 |
# File 'lib/eslint-rails-ee/warning.rb', line 30 def @message || 'N/A' end |
#rule_id ⇒ Object
26 27 28 |
# File 'lib/eslint-rails-ee/warning.rb', line 26 def rule_id @rule_id || 'N/A' end |
#severity ⇒ Object
18 19 20 |
# File 'lib/eslint-rails-ee/warning.rb', line 18 def severity SEVERITY[@severity-1] end |