Convert try_opal code into ruby (instead of js)