Sha256: e3c597514fd39c8a30ff40cca3a10732113529995a8bb84c25df894ec42aca0d

Contents?: true

Size: 880 Bytes

Versions: 22

Compression:

Stored size: 880 Bytes

Contents

class V8::Conversion
  module Code
    include V8::Weak::Cell

    def to_v8
      fn = to_template.GetFunction()
      V8::Context.link self, fn
      return fn
    end

    def to_template
      weakcell(:template) {V8::C::FunctionTemplate::New(InvocationHandler.new(self))}
    end

    class InvocationHandler
      include V8::Error::Protect

      def initialize(code)
        @code = code
      end

      def call(arguments)
        protect do
          context = V8::Context.current
          access = context.access
          args = ::Array.new(arguments.Length())
          0.upto(args.length - 1) do |i|
            if i < args.length
              args[i] = context.to_ruby arguments[i]
            end
          end
          this = context.to_ruby arguments.This()
          context.to_v8 access.methodcall(@code, this, args)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 8 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/lib/v8/conversion/code.rb
therubyracer-0.12.3 lib/v8/conversion/code.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/lib/v8/conversion/code.rb
therubyracer-xcode-0.12.3 lib/v8/conversion/code.rb
therubyracer-xcode-0.12.2 lib/v8/conversion/code.rb
therubyracer-tmpfork-0.12.2 lib/v8/conversion/code.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/lib/v8/conversion/code.rb
therubyracer-0.12.2 lib/v8/conversion/code.rb
therubyracer-0.12.1 lib/v8/conversion/code.rb
therubyracer-discourse-0.12.0 lib/v8/conversion/code.rb
therubyracer-0.12.0 lib/v8/conversion/code.rb
therubyracer-0.11.4 lib/v8/conversion/code.rb
therubyracer-0.11.3 lib/v8/conversion/code.rb
therubyracer-0.11.2 lib/v8/conversion/code.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/lib/v8/conversion/code.rb
therubyracer-0.11.1 lib/v8/conversion/code.rb
therubyracer-0.11.1beta1 lib/v8/conversion/code.rb
therubyracer-0.11.0 lib/v8/conversion/code.rb
therubyracer-0.11.0beta8-x86-freebsd-9 lib/v8/conversion/code.rb
therubyracer-0.11.0beta8-x86_64-linux lib/v8/conversion/code.rb