diff --git a/lib/execjs/graaljs_runtime.rb b/lib/execjs/graaljs_runtime.rb index fe2b5db..86121b0 100644 --- a/lib/execjs/graaljs_runtime.rb +++ b/lib/execjs/graaljs_runtime.rb @@ -98,10 +98,8 @@ def convert_ruby_to_js(value) case value when nil, true, false, Integer, Float value - when String + when String, Symbol Truffle::Interop.as_truffle_string value - when Symbol - value.to_s when Array value.map { |e| convert_ruby_to_js(e) } when Hash diff --git a/test/test_execjs.rb b/test/test_execjs.rb index dbf9703..f5b25b5 100644 --- a/test/test_execjs.rb +++ b/test/test_execjs.rb @@ -172,6 +172,9 @@ def test_symbol assert_equal "symbol", context.call("echo", :symbol) assert_equal ["symbol"], context.call("echo", [:symbol]) assert_equal({"key" => "value"}, context.call("echo", {key: :value})) + + context = ExecJS.compile("function myslice(str) { return str.slice(1); }") + assert_equal "ymbol", context.call("myslice", :symbol) end def test_additional_options