Re:Opal: Ruby to JavaScript Compiler
by ankurpatel on Thursday June 05, 2014 @12:46PM
(#7852781)
This is not pure way of doing meta programming. It looks at the code to figure out what methods are being called in future.
Opal.add_stubs(["first", "second", "to_sym"]);
But lets say I am dynamically generating method using a string passed from user input or server then this would fail.
I had the same fear at first, but actually if you generate dynamically a method name you need to use `#__send__` (and friends) to call it.
Of course `#__send__` supports method_missing: https://github.com/opal/opal/blob/0-6-stable/opal/corelib/ba...
`define_method` as well: https://github.com/opal/opal/blob/f958d6b2468e57acf7f324e10a...