Class: JSLint::Result
- Inherits:
-
Object
- Object
- JSLint::Result
- Defined in:
- lib/jslint.rb
Instance Method Summary collapse
-
#error_messages ⇒ Object
Public: A nicely formatted list of errors with their line number.
-
#initialize(valid, errors) ⇒ Result
constructor
A new instance of Result.
-
#valid? ⇒ Boolean
Public: Did the JavaScript source pass JSLint without errors?.
Constructor Details
#initialize(valid, errors) ⇒ Result
Returns a new instance of Result.
27 28 29 30 |
# File 'lib/jslint.rb', line 27 def initialize(valid, errors) @valid = valid @errors = errors end |
Instance Method Details
#error_messages ⇒ Object
Public: A nicely formatted list of errors with their line number.
Returns an Array of Strings.
44 45 46 47 48 49 50 |
# File 'lib/jslint.rb', line 44 def # @errors will have a 'nil' last element if JSLINT it hit a catastrophic # error before it finished looking at the whole file, so we 'compact'. @errors.compact.map {|e| "#{e['line']}:#{e['character']}: #{e['reason']}" } end |
#valid? ⇒ Boolean
Public: Did the JavaScript source pass JSLint without errors?
This is the return value of the JSLINT() function.
Returns true iff JSLint found no errors.
37 38 39 |
# File 'lib/jslint.rb', line 37 def valid? @valid end |