ruby-beautify
ruby-beautify copied to clipboard
Rewrite `#syntax_ok?` to not start subprocess and fix Code Climate setup
The current method is very problematic, because it expects ruby command on the PATH. There may not be any, for example when user has only JRuby installed, or it may be different ruby than the one running ruby-beautify. It also doesn't work with JRuby on Windows, due to bug jruby/jruby#1187.
To make story short, it's better to avoid executing external command. This method with eval is copied from https://www.ruby-forum.com/topic/4419079#1130079; it seems to be safe and works without problems.