Slide 83
Slide 83 text
class Console ... end
class JavaScript
def ... end
def function(*); end
def method_missing(name, *, &block)
if block_given?
define_singleton_method(name, block)
end
end
end
def javascript ... end
HelloWorld.java
javascript.rb
require "javascript"
javascript do
function hello() {
console.log("Hello world!");
}
hello();
end
hello.rb
Terminal
Functions ⤵
% ruby hello.rb
Hello world!
%
%