Originally, my colleague shared this post to Syndicode blog.
As a part of the exploration for interesting and useful Ruby repositories, I'd like to share with you the first version of Opal.
Meet Opal 1.0 - compile-to-JS language for Ruby. Learn more about possibilities for using Ruby for frontend code. The new features are just amazing.
Opal 1.0 comes with complete maps of the original MRI design. The prototype chain of any object will now have an entry for every Ruby ancestor. Let's explore the main features:
- Additions of
Module.prepend. To get the best performance, remember the rule for Opal and MRI, you need to do all your include/prepend/extend functions as early as possible and never touch them again if you can.
- If you run Opal on MRI you can now add the
c_lexergem to your
Gemfileand save time while compiling your code.
- The possibility of full filenames in compiled code.
- Adding of stack traces that find the error in the Opal code
- Inline all-in-one source maps comment with improved precision.
- Possibility to ignore missing requires during compile-time and only raise errors at runtime.
There is a bunch of other very useful features that you can be familiar with in this awesome material on the official Opal blog.
Don't miss the chance to learn about Function Composition in Ruby. It might be useful as well.