3 ms·
For better or worse, the convention in Ruby is to name methods in a second-person style [0], as if addressing the object directly: “file, do you `#exist?`”; “st
by tomstuart 4y ago
For better or worse, the convention in Ruby is to name methods in a second-person style [0], as if addressing the object directly: “file, do you `#exist?`”; “string, do you `#start_with?` foo?”. So, for consistency, `Dir.exist?` and `File.exist?` have been preferred for a long time.
[0] https://bugs.ruby-lang.org/issues/9041#note-1 https://bugs.ruby-lang.org/issues/9041#note-1
- matheusmoreira 4y agoThat's true for File objects responding to an :exist? message. For the File class, I think exists? makes more sense. Anyway, no big deal. Happy to see Ruby getting nicer and nicer every update.