Created
December 22, 2013 00:28
-
-
Save JoshCheek/8077006 to your computer and use it in GitHub Desktop.
Helper method for looking at how Opal turns Ruby code into JS. Runs anywhere coderay is loaded, e.g. pry and `irb -r coderay`
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
# try options like arity_cheeck: true | |
def h(opal_code, options={}) | |
javascript = Opal.compile opal_code, options | |
puts CodeRay.highlight(javascript, :javascript, {}, :terminal) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: