Module: ExecJS::Rails::RuntimeSupport

Defined in:
lib/execjs/rails/runtime_support.rb

Overview

Utilities which we use to handle differences between various execjs runtimes

Defined Under Namespace

Classes: DisabledError

Class Method Summary collapse

Class Method Details

.error_classObject



23
24
25
26
27
28
29
30
31
# File 'lib/execjs/rails/runtime_support.rb', line 23

def self.error_class
  if using_v8
    V8::Error
  elsif using_rhino
    Rhino::JSError
  else
    DisabledError
  end
end

.using_rhinoObject



19
20
21
# File 'lib/execjs/rails/runtime_support.rb', line 19

def self.using_rhino
  using_runtime(ExecJS::RubyRhinoRuntime)
end

.using_runtime(klass) ⇒ Object



11
12
13
# File 'lib/execjs/rails/runtime_support.rb', line 11

def self.using_runtime(klass)
  ExecJS::Runtimes.autodetect.class == klass
end

.using_v8Object



15
16
17
# File 'lib/execjs/rails/runtime_support.rb', line 15

def self.using_v8
  using_runtime(ExecJS::RubyRacerRuntime)
end