Class: SandiMeter::FileScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/sandi_meter/file_scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(log_errors = false) ⇒ FileScanner


6
7
8
9
# File 'lib/sandi_meter/file_scanner.rb', line 6

def initialize(log_errors = false)
  @log_errors = log_errors
  @calculator = SandiMeter::Calculator.new
end

Instance Method Details

#scan(path, store_details = false) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sandi_meter/file_scanner.rb', line 11

def scan(path, store_details = false)
  read_ignore_file(path) unless @exclude_patterns

  if File.directory?(path)
    scan_dir(path)
  else
    scan_file(path)
  end

  @calculator.calculate!(store_details)
end