Module: ExecJS::Runtimes

### Home Classes Methods

### In Files

- lib/execjs/runtimes.rb

### Methods

- ::autodetect
- ::best_available
- ::from_environment
- ::names
- ::runtimes

### Class/Module Index

Quicksearch

- ExecJS
- ExecJS::DisabledRuntime
- ExecJS::DuktapeRuntime
- ExecJS::DuktapeRuntime::Context
- ExecJS::Encoding
- ExecJS::Error
- ExecJS::ExternalRuntime
- ExecJS::ExternalRuntime::Context
- ExecJS::ProgramError
- ExecJS::RubyRacerRuntime
- ExecJS::RubyRacerRuntime::Context
- ExecJS::RubyRhinoRuntime
- ExecJS::RubyRhinoRuntime::Context
- ExecJS::Runtime
- ExecJS::Runtime::Context
- ExecJS::RuntimeError
- ExecJS::RuntimeUnavailable
- ExecJS::Runtimes

No matching classes.

# ExecJS::Runtimes

### Constants

Disabled
Duktape
JScript
JavaScriptCore
Node
RubyRacer
RubyRhino
SpiderMonkey

### Public Class Methods

autodetect() click to toggle source

    # File lib/execjs/runtimes.rb, line 46
    def self.autodetect
      from_environment || best_available ||
        raise(RuntimeUnavailable, "Could not find a JavaScript runtime. " +
          "See https://github.com/rails/execjs for a list of available runtimes.")
    end

best_available() click to toggle source

    # File lib/execjs/runtimes.rb, line 52
    def self.best_available
      runtimes.reject(&:deprecated?).find(&:available?)
    end

from_environment() click to toggle source

    # File lib/execjs/runtimes.rb, line 56
    def self.from_environment
      if name = ENV["EXECJS_RUNTIME"]
        raise RuntimeUnavailable, "#{name} runtime is not defined" unless const_defined?(name)
        runtime = const_get(name)

        raise RuntimeUnavailable, "#{runtime.name} runtime is not available on this system" unless runtime.available?
        runtime
      end
    end

names() click to toggle source

    # File lib/execjs/runtimes.rb, line 66
    def self.names
      @names ||= constants.inject({}) { |h, name| h.merge(const_get(name) => name) }.values
    end

runtimes() click to toggle source

    # File lib/execjs/runtimes.rb, line 70
    def self.runtimes
      @runtimes ||= [
        RubyRacer,
        RubyRhino,
        Duktape,
        JavaScriptCore,
        Node,
        SpiderMonkey,
        JScript
      ]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.