Class: Imap::Backup::Serializer::FolderMaker
- Inherits:
-
Object
- Object
- Imap::Backup::Serializer::FolderMaker
- Defined in:
- lib/imap/backup/serializer/folder_maker.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(base:, path:, permissions:) ⇒ FolderMaker
constructor
A new instance of FolderMaker.
- #run ⇒ Object
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 Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
9 10 11 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 9 def base @base end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 10 def path @path end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
11 12 13 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 11 def @permissions end |
Instance Method Details
#full_path ⇒ Object
31 32 33 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 31 def full_path File.join(base, path) end |
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 19 def run parts = path.split("/") return if parts.empty? FileUtils.mkdir_p(full_path) if !File.exist?(full_path) full = base parts.each do |part| full = File.join(full, part) FileUtils.chmod , full end end |