Module: JSLint
- Defined in:
- lib/jslint.rb,
lib/jslint/testtask.rb
Defined Under Namespace
Class Method Summary collapse
-
.context ⇒ Object
Internal: The ExecJS Context in which to run JSLINT().
-
.run(source, options = {}) ⇒ Object
Public: Run JSLint over some JavaScript source.
Class Method Details
.context ⇒ Object
Internal: The ExecJS Context in which to run JSLINT().
Provides a small helper function JSLINTR to return both the JSLINT() return value and the JSLINT.errors object.
9 10 11 12 13 14 15 |
# File 'lib/jslint.rb', line 9 def self.context ExecJS.compile( JSLint::Source.contents + "function JSLINTR(source, options) { " + "return [JSLINT(source, options),JSLINT.errors]; };" ) end |
.run(source, options = {}) ⇒ Object
Public: Run JSLint over some JavaScript source.
source - some String-like or IO-like JavaScript source. options - Hash of options passed directly to JSLINT (default: {})
21 22 23 24 |
# File 'lib/jslint.rb', line 21 def self.run(source, ={}) source = source.respond_to?(:read) ? source.read : source Result.new(*context.call("JSLINTR", source, )) end |