Sha256: 3fb55c3b9210ab6bf3b693a539b543a05a8469c98b1c42b2e328c76916034dff

Contents?: true

Size: 868 Bytes

Versions: 14

Compression:

Stored size: 868 Bytes

Contents

module V8
  class Function < V8::Object
    
    def methodcall(thisObject, *args)
      err = nil
      return_value = nil
      C::TryCatch.try do |try|
        @portal.open do |to|
          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)
      self.methodcall(@portal.context.native.Global(), *args)
    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

14 entries across 14 versions & 1 rubygems

Version Path
therubyracer-0.9.2 lib/v8/function.rb
therubyracer-0.9.2beta1 lib/v8/function.rb
therubyracer-0.9.1 lib/v8/function.rb
therubyracer-0.9.1beta1 lib/v8/function.rb
therubyracer-0.9.0 lib/v8/function.rb
therubyracer-0.9.0beta7 lib/v8/function.rb
therubyracer-0.9.0beta6 lib/v8/function.rb
therubyracer-0.9.0beta5 lib/v8/function.rb
therubyracer-0.8.2 lib/v8/function.rb
therubyracer-0.9.0beta4 lib/v8/function.rb
therubyracer-0.9.0beta3 lib/v8/function.rb
therubyracer-0.9.0beta2 lib/v8/function.rb
therubyracer-0.9.0beta1 lib/v8/function.rb
therubyracer-0.8.2.pre2 lib/v8/function.rb