In Ruby just looking at the methods for strings is enough to find this like: "instance_variable_defined?", "rindex", "tr_s", "casecmp", "equal?", "eql?" and more. Yes, it is all lower case, but consistent it is certainly not.
In Ruby just looking at the methods for strings is enough to find this like: "instance_variable_defined?", "rindex", "tr_s", "casecmp", "equal?", "eql?" and more. Yes, it is all lower case, but consistent it is certainly not.
The idea itself is cool, communicating extra context about what the method does or its intended usage, but they're used so inconsistently (even withing the Ruby stdlib) that A) They're unreliable and you need to check the source to find out the behavior anyway and B) It's less predictable whether the method exists with the suffix or without, so you need to either run it and modify your method call if there's an error or check the lib/API docs. This is the sort of thing that makes having an IDE handy for completing method names, which is unfortunate because Ruby is generally very usable without any IDE crutches.