Class: Imap::Backup::Serializer::PermissionChecker
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::PermissionChecker
- Defined in:
- lib/imap/backup/serializer/permission_checker.rb
Instance Method Summary collapse
-
#initialize(filename:, limit:) ⇒ PermissionChecker
constructor
A new instance of PermissionChecker.
- #run ⇒ Object
Constructor Details
#initialize(filename:, limit:) ⇒ PermissionChecker
Returns a new instance of PermissionChecker.
7 8 9 10 |
# File 'lib/imap/backup/serializer/permission_checker.rb', line 7 def initialize(filename:, limit:) @filename = filename @limit = limit end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/imap/backup/serializer/permission_checker.rb', line 12 def run actual = FileMode.new(filename: filename).mode return nil if actual.nil? mask = ~limit & 0o777 return if (actual & mask).zero? = format( "Permissions on '%<filename>s' " \ "should be 0%<limit>o, not 0%<actual>o", filename: filename, limit: limit, actual: actual ) raise end |