Sha256: c1254af0ad785d9da21ed79bfcdcc190fae0bc4394f1cc662d7653edb0164c52

Contents?: true

Size: 890 Bytes

Versions: 65

Compression:

Stored size: 890 Bytes

Contents

module V8
  class Function < V8::Object

    def methodcall(thisObject, *args)
      err = nil
      return_value = nil
      @portal.open do |to|
        C::TryCatch.try do |try|
          this = to.v8(thisObject)
          return_value = to.rb(@native.Call(this, to.v8(args)))
          err = JSError.new(try, to) if try.HasCaught()
        end
      end
      raise err if err
      return return_value
    end

    def call(*args)
      @portal.open do
        self.methodcall(@portal.context.native.Global(), *args)
      end
    end

    def new(*args)
      @portal.open do |to|
        to.rb(@native.NewInstance(to.v8(args)))
      end
    end

    def name
      @portal.open do |to|
        to.rb(@native.GetName())
      end
    end

    def name=(name)
      name.tap do
        @portal.open do |to|
          @native.SetName(to.v8(name))
        end
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 5 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.7.4 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.7.3 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.7.2 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.7.1 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.7.0 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.9 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.8 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.7 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.6 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.5 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.4 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.3 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.2 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.1 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.6.0 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.5.17 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.5.16 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.5.15 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb
classiccms-0.5.14 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/function.rb