Class: ExecJS::DuktapeRuntime::Context

### Home Classes Methods

### In Files

- lib/execjs/duktape_runtime.rb

### Parent

Runtime::Context

### Methods

- ::new
- #call
- #eval
- #exec

### 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::DuktapeRuntime::Context

### Public Class Methods

new(runtime, source = "") click to toggle source

    # File lib/execjs/duktape_runtime.rb, line 7
    def initialize(runtime, source = "")
      @ctx = Duktape::Context.new(complex_object: nil)
      @ctx.exec_string(encode(source), '(execjs)')
    rescue Exception => e
      raise wrap_error(e)
    end

### Public Instance Methods

call(identifier, *args) click to toggle source

    # File lib/execjs/duktape_runtime.rb, line 28
    def call(identifier, *args)
      @ctx.call_prop(identifier.split("."), *args)
    rescue Exception => e
      raise wrap_error(e)
    end

eval(source, options = {}) click to toggle source

    # File lib/execjs/duktape_runtime.rb, line 21
    def eval(source, options = {})
      return unless /\S/ =~ source
      @ctx.eval_string("(#{encode(source)})", '(execjs)')
    rescue Exception => e
      raise wrap_error(e)
    end

exec(source, options = {}) click to toggle source

    # File lib/execjs/duktape_runtime.rb, line 14
    def exec(source, options = {})
      return unless /\S/ =~ source
      @ctx.eval_string("(function(){#{encode(source)}})()", '(execjs)')
    rescue Exception => e
      raise wrap_error(e)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.