Module: JshintRuby

Defined in:
lib/jshint_ruby.rb,
lib/jshint_ruby/source.rb,
lib/jshint_ruby/version.rb

Defined Under Namespace

Classes: Result, Source

Constant Summary collapse

VERSION =
"0.1"

Class Method Summary collapse

Class Method Details

.contextObject



7
8
9
10
11
12
13
# File 'lib/jshint_ruby.rb', line 7

def self.context
  ExecJS.compile(
    Source.contents +
    "function JSHINTER(source, options, data) { " +
    "return [JSHINT(source, options, data), JSHINT.errors]; }"
  )
end

.run(source, options = {}) ⇒ Object



15
16
17
18
# File 'lib/jshint_ruby.rb', line 15

def self.run(source, options = {})
  source = source.respond_to?(:read) ? source.read : source
  Result.new(*context.call("JSHINTER", source, options, {}))
end