Class: Imap::Backup::Serializer::FolderMaker
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::FolderMaker
- Defined in:
- lib/imap/backup/serializer/folder_maker.rb
Overview
Creates directories
Instance Method Summary collapse
-
#initialize(base:, path:, permissions:) ⇒ FolderMaker
constructor
A new instance of FolderMaker.
-
#run ⇒ Object
Creates the directory and any missing parent directories, ensuring the desired permissions.
Constructor Details
#initialize(base:, path:, permissions:) ⇒ FolderMaker
Returns a new instance of FolderMaker.
13 14 15 16 17 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 13 def initialize(base:, path:, permissions:) @base = base @path = path @permissions = end |
Instance Method Details
#run ⇒ Object
Creates the directory and any missing parent directories, ensuring the desired permissions.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 21 def run parts = path.split("/") return if parts.empty? FileUtils.mkdir_p(full_path) full = base parts.each do |part| full = File.join(full, part) FileUtils.chmod , full end end |