Class: MaxSizeDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/max_size_detector.rb,
lib/max_size_detector/base.rb

Defined Under Namespace

Classes: Base

Constant Summary collapse

FILES_MAX_SIZE =
100_000

Class Method Summary collapse

Class Method Details

.run(**opts) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/max_size_detector.rb', line 4

def self.run(**opts)
  file = opts[:file] || opts[:filename]
  max_size = opts[:max_size]

  print "Opening file #{file} ..."
  base = Base.new(**opts)
  return puts "" if base.input_file.nil?

  random_done!

  print "Extracting file structure ..."
  base.extract!
  random_done!

  print "Finding directories up to #{max_size} ..."
  base.process!
  random_done!

  puts "Output:"
  puts base.show_output
end