Class: Imap::Backup::CLI::FolderEnumerator
- Inherits:
-
Object
- Object
- Imap::Backup::CLI::FolderEnumerator
- Defined in:
- lib/imap/backup/cli/folder_enumerator.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(destination:, source:, destination_delimiter: "/", destination_prefix: "", source_delimiter: "/", source_prefix: "") ⇒ FolderEnumerator
constructor
A new instance of FolderEnumerator.
Constructor Details
#initialize(destination:, source:, destination_delimiter: "/", destination_prefix: "", source_delimiter: "/", source_prefix: "") ⇒ FolderEnumerator
Returns a new instance of FolderEnumerator.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/imap/backup/cli/folder_enumerator.rb', line 13 def initialize( destination:, source:, destination_delimiter: "/", destination_prefix: "", source_delimiter: "/", source_prefix: "" ) @destination = destination @destination_delimiter = destination_delimiter @destination_prefix = destination_prefix @source = source @source_delimiter = source_delimiter @source_prefix = source_prefix end |
Instance Method Details
#each ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/imap/backup/cli/folder_enumerator.rb', line 29 def each return enum_for(:each) if !block_given? glob = File.join(source_local_path, "**", "*.imap") Pathname.glob(glob) do |path| name = source_folder_name(path) serializer = Serializer.new(source_local_path, name) folder = destination_folder_for_path(name) yield serializer, folder end end |