readable? vs. readable_real?

Today I’ve learned, that in Ruby much better way of checking whether file is using File.stat("file").readable_real? than just File.stat("file").readable? Difference is not big, but significant. Using real version allows to check whether file is readable not only when owner and user ID match, but also when file has group readable attribute and user belongs to proper group.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.