Search code examples
rubyopalrb

Opal rb eval method throws 'undefined method'


Doesn't Opal.rb have an eval method? Using eval both in classes and outside throws undefined method 'eval' Everything else works fine.


Solution

  • Kernel#eval is defined in opal-parser as it needs to be able to parse Ruby into JS in the browser, so you need to require "opal-parser" first.