简体   繁体   中英

Error while trying to convert ruby code to javascript

I'm trying to use Opal to convert ruby code to javascript. At first, it looked pretty promising, but it just doesn't work with my class. I get the below error which does not make sense to me:

SyntaxError: An error occurred while compiling: (file)

unexpected '"kEND"'
Source: (file):1:7718

Here is the gist link to the ruby file I'm trying to convert to javascript: query_builder.rb

This compiles in my ruby interpreter just fine. I'm not sure if opal is using an incompatible version of ruby or what the deal is. But my code is pretty standard ruby. Any help would be greatly appreciated. Thank you in advance.

The linked code uses hard tabs instead of the usual two spaces for indententation. According to this GitHub issue tabs seem to be an issue for Opal. So replace them with your favorite text editor and it'll compile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM