4 ms·
Opal supports `method_missing`: http://opalrb.org/docs/method_missing/ http://opalrb.org/docs/method_missing/ `define_method` as well: https://github.com/opal/
by DouweM 12y ago
Opal supports `method_missing`: http://opalrb.org/docs/method_missing/ http://opalrb.org/docs/method_missing/
`define_method` as well: https://github.com/opal/opal/blob/f958d6b2468e57acf7f324e10a06b8a8fe475f55/opal/corelib/module.rb#L256 https://github.com/opal/opal/blob/f958d6b2468e57acf7f324e10a...
- ankurpatel 12y agoThis 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.
- elia 12y agoI 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/basic_object.rb#L13-L31 https://github.com/opal/opal/blob/0-6-stable/opal/corelib/ba...