Sha256: a40910ba9ab967818373dc584343c5ad09391bbba684786bb56de97db1d42f15
Contents?: true
Size: 826 Bytes
Versions: 1
Compression:
Stored size: 826 Bytes
Contents
require_relative 'fshelpyhelp' module Stowaway class Sweeper include FSHelpyHelp def initialize(files_to_find, ext_to_ignore = nil) @files_to_find = files_to_find @ignore = ext_to_ignore || ["^\\.", ".png", ".gif", ".jpg"] end def inspect_file(file) File.open(file, 'r') do |i| while line = i.gets remove_matches(line) end end end def remove_matches(line) @files_to_find.delete_if { |file| line.include?(file.name) } end def sweep(path) dir = Dir.new(path) dir.each do |f| next if ignore?(f) file = File.join(dir.path, f) if File.directory?(file) sweep(file) else inspect_file(file) end end @files_to_find end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stowaway-0.0.1 | lib/stowaway/sweeper.rb |