3 ms·
Sure it's only mangled. I'm Ruby you can also still call private methods via .send(:method_name). IMO the goal of declaring something private is to make clear
by ajmurmann 3y ago
Sure it's only mangled. I'm Ruby you can also still call private methods via .send(:method_name).
IMO the goal of declaring something private is to make clear what you consider part of your object's public API and it's safe for others to call. It's mainly to protect callers from shooting themselves in the foot. Private provides no security. Your consumer will know better the actual situation they are in and if it's worthwhile taking the risk that your API might break them in the future or to write additional tests since they are doing something you as the author advise against. Of course it can also help enforce good design within your project. IMO it should be easy to bypass private constraints when a user makes that educated choice