lib/file_scanner/client.rb in file_scan-0.1.0 vs lib/file_scanner/client.rb in file_scan-0.1.1

- old
+ new

@@ -13,10 +13,11 @@ # @option options [Boolean] :nested Specify if nested directories should be scanned # @option options [String] extension Extension of filenames to be selected. Defaults to "*.mp4" def initialize(dir, **options) @nested = options[:nested] @extension = options[:extension].nil? ? "*.mp4" : options[:extension] + @logger = options[:logger] || $stdout @dir = dir end # @param [Proc] block Block of code to be executed for each file def each(&block) @@ -32,10 +33,10 @@ # # @param [String] dir Directory path to scan def process_directory(dir) Dir.chdir(dir) do # Process files in a given directory - print "Scanning files in #{Dir.pwd}\n".colorize(:blue) + @logger.info "Scanning files in #{Dir.pwd}".colorize(:blue) Dir.glob(@extension).sort.each { |file| @block.call(file) } # Return unless we want to scan the directories inside # the directory `dir`