Class: Imap::Backup::Serializer::Directory
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::Directory
- Defined in:
- lib/imap/backup/serializer/directory.rb
Constant Summary collapse
- DIRECTORY_PERMISSIONS =
0o700
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#relative ⇒ Object
readonly
Returns the value of attribute relative.
Instance Method Summary collapse
- #ensure_exists ⇒ Object
-
#initialize(path, relative) ⇒ Directory
constructor
A new instance of Directory.
Constructor Details
#initialize(path, relative) ⇒ Directory
Returns a new instance of Directory.
16 17 18 19 |
# File 'lib/imap/backup/serializer/directory.rb', line 16 def initialize(path, relative) @path = path @relative = relative end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
14 15 16 |
# File 'lib/imap/backup/serializer/directory.rb', line 14 def path @path end |
#relative ⇒ Object (readonly)
Returns the value of attribute relative.
13 14 15 |
# File 'lib/imap/backup/serializer/directory.rb', line 13 def relative @relative end |
Instance Method Details
#ensure_exists ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/imap/backup/serializer/directory.rb', line 21 def ensure_exists if !File.directory?(full_path) Serializer::FolderMaker.new( base: path, path: relative, permissions: DIRECTORY_PERMISSIONS ).run end return if OS.windows? return if FileMode.new(filename: full_path).mode == DIRECTORY_PERMISSIONS FileUtils.chmod DIRECTORY_PERMISSIONS, full_path end |