class DirectoryProcessor

Attributes

ext[RW]
path[RW]

Public Class Methods

call(path, ext) click to toggle source
# File lib/rforward/directory_processor.rb, line 19
def self.call path, ext
  path = Pathname.new path
  raise WrongPathEx, path unless path.directory? && path.exist?
  processor = DirectoryProcessor.new path.to_path, ext
  processor.call
end
new(path, ext) click to toggle source
# File lib/rforward/directory_processor.rb, line 6
def initialize path, ext
  @path, @ext = path, ext
end

Public Instance Methods

call() click to toggle source
# File lib/rforward/directory_processor.rb, line 10
def call
  files_arr = Dir["#{path}/**#{ext}"]
  files_arr = files_arr.select { |file| File.file? file } 
  Stat.instance.files_total = files_arr.count
  files_arr.each do |filepath|
    FileProcessor.call filepath
  end
end