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.
11 12 13 14 15 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 11 def initialize(base:, path:, permissions:) @base = base @path = path = end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
7 8 9 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 7 def base @base end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 8 def path @path end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
9 10 11 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 9 def end |
Instance Method Details
#full_path ⇒ Object
29 30 31 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 29 def full_path File.join(base, path) end |
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/imap/backup/serializer/folder_maker.rb', line 17 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 |