Sha256: f4a5723fede7699512b0aec06a0e28975760db12a6224fd669e4541181cdccef

Contents?: true

Size: 538 Bytes

Versions: 1

Compression:

Stored size: 538 Bytes

Contents

module ESLintRails
  class Warning
    attr_reader :rule_id, :message, :line, :column, :node_type

    SEVERITY = [ :low, :high ].freeze
    private_constant :SEVERITY

    def initialize(warning_hash)
      @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

    def severity
      SEVERITY[@severity-1]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eslint-rails-1.0.2 lib/eslint-rails/warning.rb