It would be easier to use the JSON module for that.
require 'json'
arr = ["h","b","c"]
json = ::JSON.dump(arr)
dialog.execute_script("send(#{json})")
The great part of this is that on the javascript side the parameter comes in as an object, or array in this case.
Also, regarding calling a javascript function from ruby, assing it to the window object:
window.fromSketchUp = (argument) => {
alert(argument.name);
}
and in ruby:
require 'json'
arg = {
name: "some name",
id: 1
}
json = ::JSON.dump(arg)
dialog.execute_script("window.fromSketchUp(#{json})")
I think this solves: