Sha256: c462c08dadab0aeed8efcb2573b9db0e87e04716ceb90cd1c76dd8839b352b23

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true

require_relative 'file_handler'
require_relative 'file_order'

module OrganizeFiles
  # organizer.rb
  class Organizer
    attr_reader :directory, :types, :new_folder, :new_path

    def initialize(directory)
      @directory = directory
      @file_handler = FileHandler.new(directory)
    end

    def organize
      @file_handler.scan_files.each do |file|
        next if File.directory?(file)

        categorize_file = OrganizeFiles::FileOrder.new(file).categorize
        @file_handler.move_file(file, categorize_file)
        @file_handler.remove_empty_folders
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
organize_files-1.0.7 lib/organize_files/organizer.rb
organize_files-1.0.6 lib/organize_files/organizer.rb
organize_files-1.0.5 lib/organize_files/organizer.rb