Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
coś nie tak
"app.rb"
[1, 2, 3].each { |a| puts a }
"ruby2js.rb"
#!/usr/bin/ruby
# encoding: utf-8
require 'opal'
ruby_file = ARGV[0]
parser = Opal::Parser.new
open("#{File.basename(ruby_file,".rb")}.js", "w") do |stream|
stream.puts parser.parse(File.read(ruby_file))
end
and i get
"app.js"
call
array
int
1
int
2
int
3
each
arglist
iter
lasgn
a
call
puts
arglist
lvar
a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment