Returns a Hash of LocalFile objects for each file within dir, except those matching any of the excludes. Hash keys are the file’s path relative to dir.
# File lib/backup/syncer/cloud/local_file.rb, line 15 def find(dir, excludes = []) dir = File.expand_path(dir) hash = {} find_md5(dir, excludes).each do |file| hash[file.path.sub(dir + '/', '')] = file end hash end
Return a new LocalFile object if it’s valid. Otherwise, log a warning and return nil.
# File lib/backup/syncer/cloud/local_file.rb, line 26 def new(*args) file = super if file.invalid? Logger.warn("\s\s[skipping] #{ file.path }\n" + "\s\sPath Contains Invalid UTF-8 byte sequences") file = nil end file end
If path contains invalid UTF-8, it will be sanitized and the LocalFile object will be flagged as invalid. This is done so @file.path may be logged.
# File lib/backup/syncer/cloud/local_file.rb, line 74 def initialize(path) @path = sanitize(path) end
Generated with the Darkfish Rdoc Generator 2.