Class: Aruba::Platforms::DetermineDiskUsage

Inherits:
Object
  • Object
show all
Defined in:
lib/aruba/platforms/determine_disk_usage.rb

Overview

Determinate disk usage

Instance Method Summary collapse

Instance Method Details

#call(*args) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aruba/platforms/determine_disk_usage.rb', line 11

def call(*args)
  args = args.flatten

  deprecated_block_size = args.pop
  paths = args

  size = paths.flatten.map do |p|
    # TODO: replace the `call` methods signature so that you can use just
    # p.minimum_disk_space_used
    #
    # (Same result, since the values are multiplied, so
    # deprecated_block_size is canceled out
    DiskUsageCalculator.new.call(
      (p.minimum_disk_space_used / deprecated_block_size),
      deprecated_block_size
    )
  end.inject(0, &:+)

  FileSize.new(size)
end