quickjs 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/quickjsrb/quickjsrb.c +141 -117
- data/ext/quickjsrb/quickjsrb.h +17 -0
- data/lib/quickjs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz: '
|
3
|
+
metadata.gz: d949a011a5d0f2a19d351045d6a0de4550beee0908758c477a339af9d1e5863b
|
4
|
+
data.tar.gz: '09a2510b4a484e6b35a7be189cbd4015a3c575c0a318e8514beee56336c0055e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ecb1d0510082d9c0eca95ee6ef7257ff8f15ff4a2ea60fe9bc69e1274de689e71671b0f3f56ddcbe2c23421fa6fcd00b9cafadba653b89550447eb3b2a6310
|
7
|
+
data.tar.gz: af34d0b17332ba6df2e6f6c165d38cdd15ee4684a03f4bc5dc92dac2acdf5512313b263d775e9c942ab70a144e5317b1695b402ecf958ad3a86750662f84e675
|
data/README.md
CHANGED
@@ -158,6 +158,6 @@ vm,logs.last.raw #=> ['log me', nil]
|
|
158
158
|
|
159
159
|
## License
|
160
160
|
|
161
|
-
Every file in `ext/quickjsrb/quickjs` is licensed under [the MIT License Copyright 2017-2021 by Fabrice Bellard and Charlie
|
161
|
+
Every file in `ext/quickjsrb/quickjs` is licensed under [the MIT License Copyright 2017-2021 by Fabrice Bellard and Charlie Gordon](https://github.com/bellard/quickjs/blob/6e2e68fd0896957f92eb6c242a2e048c1ef3cae0/LICENSE).
|
162
162
|
|
163
163
|
For otherwise, [the MIT License, Copyright 2024 by Kengo Hamasaki](/LICENSE).
|
data/ext/quickjsrb/quickjsrb.c
CHANGED
@@ -109,6 +109,25 @@ VALUE r_try_json_parse(VALUE r_str)
|
|
109
109
|
return rb_funcall(rb_const_get(rb_cClass, rb_intern("JSON")), rb_intern("parse"), 1, r_str);
|
110
110
|
}
|
111
111
|
|
112
|
+
VALUE to_r_json(JSContext *ctx, JSValue j_val)
|
113
|
+
{
|
114
|
+
JSValue j_global = JS_GetGlobalObject(ctx);
|
115
|
+
JSValue j_jsonClass = JS_GetPropertyStr(ctx, j_global, "JSON");
|
116
|
+
JSValue j_stringifyFunc = JS_GetPropertyStr(ctx, j_jsonClass, "stringify");
|
117
|
+
JSValue j_strigified = JS_Call(ctx, j_stringifyFunc, j_jsonClass, 1, &j_val);
|
118
|
+
|
119
|
+
const char *msg = JS_ToCString(ctx, j_strigified);
|
120
|
+
VALUE r_str = rb_str_new2(msg);
|
121
|
+
JS_FreeCString(ctx, msg);
|
122
|
+
|
123
|
+
JS_FreeValue(ctx, j_strigified);
|
124
|
+
JS_FreeValue(ctx, j_stringifyFunc);
|
125
|
+
JS_FreeValue(ctx, j_jsonClass);
|
126
|
+
JS_FreeValue(ctx, j_global);
|
127
|
+
|
128
|
+
return r_str;
|
129
|
+
}
|
130
|
+
|
112
131
|
VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
113
132
|
{
|
114
133
|
switch (JS_VALUE_GET_NORM_TAG(j_val))
|
@@ -135,10 +154,16 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
|
135
154
|
}
|
136
155
|
case JS_TAG_STRING:
|
137
156
|
{
|
138
|
-
|
139
|
-
VALUE
|
140
|
-
|
141
|
-
|
157
|
+
int couldntParse;
|
158
|
+
VALUE r_result = rb_protect(r_try_json_parse, to_r_json(ctx, j_val), &couldntParse);
|
159
|
+
if (couldntParse)
|
160
|
+
{
|
161
|
+
return Qnil;
|
162
|
+
}
|
163
|
+
else
|
164
|
+
{
|
165
|
+
return r_result;
|
166
|
+
}
|
142
167
|
}
|
143
168
|
case JS_TAG_OBJECT:
|
144
169
|
{
|
@@ -159,20 +184,7 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
|
159
184
|
}
|
160
185
|
// will support other errors like just returning an instance of Error
|
161
186
|
}
|
162
|
-
|
163
|
-
JSValue j_global = JS_GetGlobalObject(ctx);
|
164
|
-
JSValue j_jsonClass = JS_GetPropertyStr(ctx, j_global, "JSON");
|
165
|
-
JSValue j_stringifyFunc = JS_GetPropertyStr(ctx, j_jsonClass, "stringify");
|
166
|
-
JSValue j_strigified = JS_Call(ctx, j_stringifyFunc, j_jsonClass, 1, &j_val);
|
167
|
-
|
168
|
-
const char *msg = JS_ToCString(ctx, j_strigified);
|
169
|
-
VALUE r_str = rb_str_new2(msg);
|
170
|
-
JS_FreeCString(ctx, msg);
|
171
|
-
|
172
|
-
JS_FreeValue(ctx, j_strigified);
|
173
|
-
JS_FreeValue(ctx, j_stringifyFunc);
|
174
|
-
JS_FreeValue(ctx, j_jsonClass);
|
175
|
-
JS_FreeValue(ctx, j_global);
|
187
|
+
VALUE r_str = to_r_json(ctx, j_val);
|
176
188
|
|
177
189
|
if (rb_funcall(r_str, rb_intern("=="), 1, rb_str_new2("undefined")))
|
178
190
|
{
|
@@ -221,16 +233,8 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
|
221
233
|
snprintf(headline, length + 1, headlineTemplate, errorClassName, errorClassMessage, stackTrace);
|
222
234
|
|
223
235
|
VMData *data = JS_GetContextOpaque(ctx);
|
224
|
-
VALUE
|
225
|
-
|
226
|
-
rb_iv_set(r_log, "@severity", ID2SYM(rb_intern("error")));
|
227
|
-
VALUE r_row = rb_ary_new();
|
228
|
-
VALUE r_loghash = rb_hash_new();
|
229
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("raw")), rb_str_new2(headline));
|
230
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("c")), rb_str_new2(headline));
|
231
|
-
rb_ary_push(r_row, r_loghash);
|
232
|
-
rb_iv_set(r_log, "@row", r_row);
|
233
|
-
rb_ary_push(data->logs, r_log);
|
236
|
+
VALUE r_headline = rb_str_new2(headline);
|
237
|
+
rb_ary_push(data->logs, r_log_new("error", rb_ary_new3(1, r_log_body_new(r_headline, r_headline))));
|
234
238
|
|
235
239
|
JS_FreeValue(ctx, j_errorClassMessage);
|
236
240
|
JS_FreeValue(ctx, j_errorClassName);
|
@@ -271,16 +275,8 @@ VALUE to_rb_value(JSContext *ctx, JSValue j_val)
|
|
271
275
|
snprintf(headline, length + 1, headlineTemplate, errorMessage);
|
272
276
|
|
273
277
|
VMData *data = JS_GetContextOpaque(ctx);
|
274
|
-
VALUE
|
275
|
-
|
276
|
-
rb_iv_set(r_log, "@severity", ID2SYM(rb_intern("error")));
|
277
|
-
VALUE r_row = rb_ary_new();
|
278
|
-
VALUE r_loghash = rb_hash_new();
|
279
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("raw")), rb_str_new2(headline));
|
280
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("c")), rb_str_new2(headline));
|
281
|
-
rb_ary_push(r_row, r_loghash);
|
282
|
-
rb_iv_set(r_log, "@row", r_row);
|
283
|
-
rb_ary_push(data->logs, r_log);
|
278
|
+
VALUE r_headline = rb_str_new2(headline);
|
279
|
+
rb_ary_push(data->logs, r_log_new("error", rb_ary_new3(1, r_log_body_new(r_headline, r_headline))));
|
284
280
|
|
285
281
|
free(headline);
|
286
282
|
|
@@ -324,84 +320,118 @@ static VALUE r_try_call_proc(VALUE r_try_args)
|
|
324
320
|
);
|
325
321
|
}
|
326
322
|
|
327
|
-
static JSValue js_quickjsrb_call_global(JSContext *ctx, JSValueConst _this, int
|
323
|
+
static JSValue js_quickjsrb_call_global(JSContext *ctx, JSValueConst _this, int argc, JSValueConst *argv, int _magic, JSValue *func_data)
|
328
324
|
{
|
329
|
-
|
330
|
-
JSValue j_maybeFuncName = JS_ToString(ctx, argv[0]);
|
331
|
-
const char *funcName = JS_ToCString(ctx, j_maybeFuncName);
|
332
|
-
JS_FreeValue(ctx, j_maybeFuncName);
|
325
|
+
const char *funcName = JS_ToCString(ctx, func_data[0]);
|
333
326
|
|
327
|
+
VMData *data = JS_GetContextOpaque(ctx);
|
334
328
|
VALUE r_proc = rb_hash_aref(data->defined_functions, rb_str_new2(funcName));
|
329
|
+
// Shouldn't happen
|
335
330
|
if (r_proc == Qnil)
|
336
|
-
{
|
337
|
-
return JS_ThrowReferenceError(ctx, "Proc `%s` is not defined", funcName);
|
331
|
+
{
|
332
|
+
return JS_ThrowReferenceError(ctx, "Proc `%s` is not defined", funcName); // TODO: Free funcnName
|
338
333
|
}
|
334
|
+
JS_FreeCString(ctx, funcName);
|
339
335
|
|
340
336
|
VALUE r_call_args = rb_ary_new();
|
341
337
|
rb_ary_push(r_call_args, r_proc);
|
342
|
-
|
338
|
+
|
339
|
+
VALUE r_argv = rb_ary_new();
|
340
|
+
for (int i = 0; i < argc; i++)
|
341
|
+
{
|
342
|
+
rb_ary_push(r_argv, to_rb_value(ctx, argv[i]));
|
343
|
+
}
|
344
|
+
rb_ary_push(r_call_args, r_argv);
|
343
345
|
rb_ary_push(r_call_args, ULONG2NUM(data->eval_time->limit * 1000 / CLOCKS_PER_SEC));
|
344
346
|
|
345
347
|
int sadnessHappened;
|
346
|
-
|
347
|
-
|
348
|
-
if (sadnessHappened)
|
348
|
+
|
349
|
+
if (JS_ToBool(ctx, func_data[1]))
|
349
350
|
{
|
350
|
-
|
351
|
-
JSValue
|
352
|
-
|
351
|
+
JSValue promise, resolving_funcs[2];
|
352
|
+
JSValue ret_val;
|
353
|
+
|
354
|
+
promise = JS_NewPromiseCapability(ctx, resolving_funcs);
|
355
|
+
if (JS_IsException(promise))
|
356
|
+
return JS_EXCEPTION;
|
357
|
+
|
358
|
+
// Currently, it's blocking process but should be asynchronized
|
359
|
+
JSValue j_result;
|
360
|
+
VALUE r_result = rb_protect(r_try_call_proc, r_call_args, &sadnessHappened);
|
361
|
+
if (sadnessHappened)
|
362
|
+
{
|
363
|
+
VALUE r_error = rb_errinfo();
|
364
|
+
j_result = j_error_from_ruby_error(ctx, r_error);
|
365
|
+
ret_val = JS_Call(ctx, resolving_funcs[1], JS_UNDEFINED,
|
366
|
+
1, (JSValueConst *)&j_result);
|
367
|
+
}
|
368
|
+
else
|
369
|
+
{
|
370
|
+
j_result = to_js_value(ctx, r_result);
|
371
|
+
ret_val = JS_Call(ctx, resolving_funcs[0], JS_UNDEFINED,
|
372
|
+
1, (JSValueConst *)&j_result);
|
373
|
+
}
|
374
|
+
JS_FreeValue(ctx, j_result);
|
375
|
+
JS_FreeValue(ctx, ret_val);
|
376
|
+
JS_FreeValue(ctx, resolving_funcs[0]);
|
377
|
+
JS_FreeValue(ctx, resolving_funcs[1]);
|
378
|
+
return promise;
|
353
379
|
}
|
354
380
|
else
|
355
381
|
{
|
356
|
-
|
382
|
+
VALUE r_result = rb_protect(r_try_call_proc, r_call_args, &sadnessHappened);
|
383
|
+
if (sadnessHappened)
|
384
|
+
{
|
385
|
+
VALUE r_error = rb_errinfo();
|
386
|
+
JSValue j_error = j_error_from_ruby_error(ctx, r_error);
|
387
|
+
return JS_Throw(ctx, j_error);
|
388
|
+
}
|
389
|
+
else
|
390
|
+
{
|
391
|
+
return to_js_value(ctx, r_result);
|
392
|
+
}
|
357
393
|
}
|
358
|
-
JS_FreeCString(ctx, funcName);
|
359
|
-
return j_result;
|
360
394
|
}
|
361
395
|
|
362
|
-
static JSValue js_quickjsrb_log(JSContext *ctx, JSValueConst _this, int
|
396
|
+
static JSValue js_quickjsrb_log(JSContext *ctx, JSValueConst _this, int argc, JSValueConst *argv, const char *severity)
|
363
397
|
{
|
364
398
|
VMData *data = JS_GetContextOpaque(ctx);
|
365
|
-
JSValue j_severity = JS_ToString(ctx, argv[0]);
|
366
|
-
const char *severity = JS_ToCString(ctx, j_severity);
|
367
|
-
JS_FreeValue(ctx, j_severity);
|
368
|
-
|
369
|
-
VALUE r_log_class = rb_const_get(rb_const_get(rb_const_get(rb_cClass, rb_intern("Quickjs")), rb_intern("VM")), rb_intern("Log"));
|
370
|
-
VALUE r_log = rb_funcall(r_log_class, rb_intern("new"), 0);
|
371
|
-
rb_iv_set(r_log, "@severity", ID2SYM(rb_intern(severity)));
|
372
|
-
JS_FreeCString(ctx, severity);
|
373
|
-
|
374
399
|
VALUE r_row = rb_ary_new();
|
375
|
-
int i;
|
376
|
-
JSValue j_length = JS_GetPropertyStr(ctx, argv[1], "length");
|
377
|
-
int count;
|
378
|
-
JS_ToInt32(ctx, &count, j_length);
|
379
|
-
JS_FreeValue(ctx, j_length);
|
380
|
-
|
381
|
-
for (i = 0; i < count; i++)
|
400
|
+
for (int i = 0; i < argc; i++)
|
382
401
|
{
|
383
|
-
|
384
|
-
|
385
|
-
if (JS_VALUE_GET_NORM_TAG(j_logged) == JS_TAG_OBJECT && JS_PromiseState(ctx, j_logged) != -1)
|
386
|
-
{
|
387
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("raw")), rb_str_new2("Promise"));
|
388
|
-
}
|
389
|
-
else
|
390
|
-
{
|
391
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("raw")), to_rb_value(ctx, j_logged));
|
392
|
-
}
|
402
|
+
JSValue j_logged = argv[i];
|
403
|
+
VALUE r_raw = JS_VALUE_GET_NORM_TAG(j_logged) == JS_TAG_OBJECT && JS_PromiseState(ctx, j_logged) != -1 ? rb_str_new2("Promise") : to_rb_value(ctx, j_logged);
|
393
404
|
const char *body = JS_ToCString(ctx, j_logged);
|
394
|
-
|
395
|
-
rb_hash_aset(r_loghash, ID2SYM(rb_intern("c")), rb_str_new2(body));
|
405
|
+
VALUE r_c = rb_str_new2(body);
|
396
406
|
JS_FreeCString(ctx, body);
|
397
|
-
|
407
|
+
|
408
|
+
rb_ary_push(r_row, r_log_body_new(r_raw, r_c));
|
398
409
|
}
|
399
410
|
|
400
|
-
|
401
|
-
rb_ary_push(data->logs, r_log);
|
411
|
+
rb_ary_push(data->logs, r_log_new(severity, r_row));
|
402
412
|
return JS_UNDEFINED;
|
403
413
|
}
|
404
414
|
|
415
|
+
static JSValue js_console_info(JSContext *ctx, JSValueConst this, int argc, JSValueConst *argv)
|
416
|
+
{
|
417
|
+
return js_quickjsrb_log(ctx, this, argc, argv, "info");
|
418
|
+
}
|
419
|
+
|
420
|
+
static JSValue js_console_verbose(JSContext *ctx, JSValueConst this, int argc, JSValueConst *argv)
|
421
|
+
{
|
422
|
+
return js_quickjsrb_log(ctx, this, argc, argv, "verbose");
|
423
|
+
}
|
424
|
+
|
425
|
+
static JSValue js_console_warn(JSContext *ctx, JSValueConst this, int argc, JSValueConst *argv)
|
426
|
+
{
|
427
|
+
return js_quickjsrb_log(ctx, this, argc, argv, "warning");
|
428
|
+
}
|
429
|
+
|
430
|
+
static JSValue js_console_error(JSContext *ctx, JSValueConst this, int argc, JSValueConst *argv)
|
431
|
+
{
|
432
|
+
return js_quickjsrb_log(ctx, this, argc, argv, "error");
|
433
|
+
}
|
434
|
+
|
405
435
|
static VALUE vm_m_initialize(int argc, VALUE *argv, VALUE r_self)
|
406
436
|
{
|
407
437
|
VALUE r_opts;
|
@@ -473,29 +503,27 @@ static VALUE vm_m_initialize(int argc, VALUE *argv, VALUE r_self)
|
|
473
503
|
JS_FreeValue(data->context, j_timeoutEval);
|
474
504
|
}
|
475
505
|
|
476
|
-
JSValue j_global = JS_GetGlobalObject(data->context);
|
477
|
-
JSValue j_quickjsrbGlobal = JS_NewObject(data->context);
|
478
|
-
JS_SetPropertyStr(
|
479
|
-
data->context, j_quickjsrbGlobal, "runRubyMethod",
|
480
|
-
JS_NewCFunction(data->context, js_quickjsrb_call_global, "runRubyMethod", 2));
|
481
|
-
|
482
|
-
JS_SetPropertyStr(data->context, j_global, "__quickjsrb", j_quickjsrbGlobal);
|
483
|
-
|
484
506
|
JSValue j_console = JS_NewObject(data->context);
|
485
507
|
JS_SetPropertyStr(
|
486
|
-
data->context,
|
487
|
-
JS_NewCFunction(data->context,
|
508
|
+
data->context, j_console, "log",
|
509
|
+
JS_NewCFunction(data->context, js_console_info, "log", 1));
|
510
|
+
JS_SetPropertyStr(
|
511
|
+
data->context, j_console, "debug",
|
512
|
+
JS_NewCFunction(data->context, js_console_verbose, "debug", 1));
|
513
|
+
JS_SetPropertyStr(
|
514
|
+
data->context, j_console, "info",
|
515
|
+
JS_NewCFunction(data->context, js_console_info, "info", 1));
|
516
|
+
JS_SetPropertyStr(
|
517
|
+
data->context, j_console, "warn",
|
518
|
+
JS_NewCFunction(data->context, js_console_warn, "warn", 1));
|
519
|
+
JS_SetPropertyStr(
|
520
|
+
data->context, j_console, "error",
|
521
|
+
JS_NewCFunction(data->context, js_console_error, "error", 1));
|
522
|
+
|
523
|
+
JSValue j_global = JS_GetGlobalObject(data->context);
|
488
524
|
JS_SetPropertyStr(data->context, j_global, "console", j_console);
|
489
525
|
JS_FreeValue(data->context, j_global);
|
490
526
|
|
491
|
-
const char *defineLoggers = "console.log = (...args) => __quickjsrb.log('info', args);\n"
|
492
|
-
"console.debug = (...args) => __quickjsrb.log('verbose', args);\n"
|
493
|
-
"console.info = (...args) => __quickjsrb.log('info', args);\n"
|
494
|
-
"console.warn = (...args) => __quickjsrb.log('warning', args);\n"
|
495
|
-
"console.error = (...args) => __quickjsrb.log('error', args);\n";
|
496
|
-
JSValue j_defineLoggers = JS_Eval(data->context, defineLoggers, strlen(defineLoggers), "<vm>", JS_EVAL_TYPE_GLOBAL);
|
497
|
-
JS_FreeValue(data->context, j_defineLoggers);
|
498
|
-
|
499
527
|
return r_self;
|
500
528
|
}
|
501
529
|
|
@@ -544,27 +572,23 @@ static VALUE vm_m_defineGlobalFunction(int argc, VALUE *argv, VALUE r_self)
|
|
544
572
|
VALUE r_block;
|
545
573
|
rb_scan_args(argc, argv, "10*&", &r_name, &r_flags, &r_block);
|
546
574
|
|
547
|
-
const char *asyncKeyword =
|
548
|
-
RTEST(rb_funcall(r_flags, rb_intern("include?"), 1, ID2SYM(rb_intern("async")))) ? "async " : "";
|
549
|
-
|
550
575
|
VMData *data;
|
551
576
|
TypedData_Get_Struct(r_self, VMData, &vm_type, data);
|
552
577
|
|
553
578
|
rb_hash_aset(data->defined_functions, r_name, r_block);
|
554
579
|
char *funcName = StringValueCStr(r_name);
|
555
580
|
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
snprintf(result, length + 1, template, funcName, asyncKeyword, funcName);
|
581
|
+
JSValueConst ruby_data[2];
|
582
|
+
ruby_data[0] = JS_NewString(data->context, funcName);
|
583
|
+
ruby_data[1] = JS_NewBool(data->context, RTEST(rb_funcall(r_flags, rb_intern("include?"), 1, ID2SYM(rb_intern("async")))));
|
560
584
|
|
561
|
-
JSValue
|
585
|
+
JSValue j_global = JS_GetGlobalObject(data->context);
|
586
|
+
JS_SetPropertyStr(
|
587
|
+
data->context, j_global, funcName,
|
588
|
+
JS_NewCFunctionData(data->context, js_quickjsrb_call_global, 1, 0, 2, ruby_data));
|
589
|
+
JS_FreeValue(data->context, j_global);
|
562
590
|
|
563
|
-
free(result);
|
564
|
-
JS_FreeValue(data->context, j_codeResult);
|
565
591
|
return rb_funcall(r_name, rb_intern("to_sym"), 0, NULL);
|
566
|
-
|
567
|
-
return Qnil;
|
568
592
|
}
|
569
593
|
|
570
594
|
static VALUE vm_m_import(int argc, VALUE *argv, VALUE r_self)
|
data/ext/quickjsrb/quickjsrb.h
CHANGED
@@ -178,6 +178,23 @@ static VALUE r_define_log_class(VALUE r_parent_class)
|
|
178
178
|
return r_log_class;
|
179
179
|
}
|
180
180
|
|
181
|
+
static VALUE r_log_new(const char *severity, VALUE r_row)
|
182
|
+
{
|
183
|
+
VALUE r_log_class = rb_const_get(rb_const_get(rb_const_get(rb_cClass, rb_intern("Quickjs")), rb_intern("VM")), rb_intern("Log"));
|
184
|
+
VALUE r_log = rb_funcall(r_log_class, rb_intern("new"), 0);
|
185
|
+
rb_iv_set(r_log, "@severity", ID2SYM(rb_intern(severity)));
|
186
|
+
rb_iv_set(r_log, "@row", r_row);
|
187
|
+
return r_log;
|
188
|
+
}
|
189
|
+
|
190
|
+
static VALUE r_log_body_new(VALUE r_raw, VALUE r_c)
|
191
|
+
{
|
192
|
+
VALUE r_log_body = rb_hash_new();
|
193
|
+
rb_hash_aset(r_log_body, ID2SYM(rb_intern("raw")), r_raw);
|
194
|
+
rb_hash_aset(r_log_body, ID2SYM(rb_intern("c")), r_c);
|
195
|
+
return r_log_body;
|
196
|
+
}
|
197
|
+
|
181
198
|
// Exceptions
|
182
199
|
|
183
200
|
#define QUICKJSRB_ROOT_RUNTIME_ERROR "RuntimeError"
|
data/lib/quickjs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hmsk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|