Refactor ruby.js for easy browserfy