5 ms·
Ruby also has this. e.g. you can use send to call private methods during testing (and then use static analysis like rubocop to ensure only public_send is used i
by Lio 3y ago
Ruby also has this. e.g. you can use send to call private methods during testing (and then use static analysis like rubocop to ensure only public_send is used in production).
You also can simulate it in JavaScript by using a closure and a separate package for your "private" functions. By mixing the "private" code into the closure you can make it private in usage but still available to unit tests.