Sha256: 56fa48ddb92d62e586a7e72604a75a417c143a3f60e17492b7a7dbb6ac6a4d2c

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

#include "tomato.h"

// Executes a string within the current v8 context.
VALUE execute(V8Tomato *tomato, Handle<String> source, Handle<Value> name)
{
  HandleScope handle_scope;
  TryCatch try_catch;
  Handle<Script> script = Script::Compile(source, name);
  if (script.IsEmpty())
  {
    raise_error(&try_catch);
    return Qnil;
  }
  else
  {
    Handle<Value> result = script->Run();
    if (result.IsEmpty())
    {
      raise_error(&try_catch);
      return Qnil;
    }
    else
    {
      return ruby_value_of(tomato, result);
    }
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tomato-0.0.1.prealpha2 ext/tomato/v8.cpp
tomato-0.0.1.prealpha1 ext/tomato/v8.cpp