Created
March 1, 2015 20:47
-
-
Save texrg/5d3ee2bd59354955e30e to your computer and use it in GitHub Desktop.
coś nie tak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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