Sha256: 9c0c990289b83ebad6aad7fdc33ba00398df46eef3a44926448f848b213362fb

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

require "fileutils"

module Imap::Backup
  class Serializer; end

  class Serializer::FolderMaker
    attr_reader :base
    attr_reader :path
    attr_reader :permissions

    def initialize(base:, path:, permissions:)
      @base = base
      @path = path
      @permissions = permissions
    end

    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 permissions, full
      end
    end

    def full_path
      File.join(base, path)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imap-backup-10.0.0 lib/imap/backup/serializer/folder_maker.rb