Skip to content

Instantly share code, notes, and snippets.

@texrg
Created March 1, 2015 20:47
Show Gist options
  • Save texrg/5d3ee2bd59354955e30e to your computer and use it in GitHub Desktop.
Save texrg/5d3ee2bd59354955e30e to your computer and use it in GitHub Desktop.
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