Class: Imap::Backup::FileMode
- Inherits:
-
Object
- Object
- Imap::Backup::FileMode
- Defined in:
- lib/imap/backup/file_mode.rb
Overview
Accesses a file’s access permissions
Instance Method Summary collapse
-
#initialize(filename:) ⇒ FileMode
constructor
A new instance of FileMode.
-
#mode ⇒ Integer?
The user, group and “other” part of the file’s “mode”.
Constructor Details
#initialize(filename:) ⇒ FileMode
Returns a new instance of FileMode.
6 7 8 |
# File 'lib/imap/backup/file_mode.rb', line 6 def initialize(filename:) @filename = filename end |
Instance Method Details
#mode ⇒ Integer?
Returns The user, group and “other” part of the file’s “mode”.
11 12 13 14 15 16 |
# File 'lib/imap/backup/file_mode.rb', line 11 def mode return nil if !File.exist?(filename) stat = File.stat(filename) stat.mode & 0o777 end |