3 ms·
No, unfortunately. This is one thing I've always wished Ruby had.
by thr0wawayf00 4y ago
No, unfortunately. This is one thing I've always wished Ruby had.
- remram 4y agoRuby is object-oriented, for better or for worse. Similar to Java, you can have static methods, but they have to live in a class (or module in Ruby's case).
- thr0wawayf00 4y agoI assumed OP was asking if Ruby had a way to import specific functions from a module (i.e. "from math import pi".) the way that many other languages (like Python) support. Instead, Ruby forces you to require the entire module, which makes tracking public interface usage harder.
- kayodelycaon 4y agoIf you're looking for that level of granularity, you can implement each method as a class, or as a static method on a class or module. Then it's fairly easy to figure out where things are used.