Class: JslintRb::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/jslint-rb/error.rb

Overview

This object encapsulates the output from JSHint. Does some minimal formatting

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jsobject) ⇒ Error

Returns a new instance of Error.



19
20
21
22
23
24
25
# File 'lib/jslint-rb/error.rb', line 19

def initialize(jsobject)
  @line_number = jsobject["line"]
  @character = jsobject["character"]
  @reason = jsobject["reason"]
  @evidence = jsobject["evidence"]
  @evidence.strip! unless @evidence.nil?
end

Instance Attribute Details

#characterObject (readonly)

Column number of the JSHint error



11
12
13
# File 'lib/jslint-rb/error.rb', line 11

def character
  @character
end

#evidenceObject (readonly)

The snippet of code that caused the error



17
18
19
# File 'lib/jslint-rb/error.rb', line 17

def evidence
  @evidence
end

#line_numberObject (readonly)

Line number the JSHint error occured on



8
9
10
# File 'lib/jslint-rb/error.rb', line 8

def line_number
  @line_number
end

#reasonObject (readonly)

The actual error that was discovered



14
15
16
# File 'lib/jslint-rb/error.rb', line 14

def reason
  @reason
end