Sha256: f30410662f34344724d12a2ee2c24c2b288049df0f0a4c79e18a1feec1d6f90e

Contents?: true

Size: 394 Bytes

Versions: 2

Compression:

Stored size: 394 Bytes

Contents

require 'fileutils'

module XcodeTrashRemover
  module SizeHelper
    module_function

    def dir_size(dir_path)
      dir_path << '/' unless dir_path.end_with?('/')
      total_size = 0
      if File.directory?(dir_path)
        Dir["#{dir_path}**/*"].each do |f|
          total_size += File.size(f) if File.file?(f) && File.size?(f)
        end
      end
      total_size
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xcode_trash_remover-2.0.3 lib/xcode_trash_remover/size_helper.rb
xcode_trash_remover-2.0.2 lib/xcode_trash_remover/size_helper.rb