Parent

Class/Module Index [+]

Quicksearch

Backup::Syncer::Cloud::LocalFile

Attributes

md5[RW]
path[R]

Public Class Methods

find(dir, excludes = []) click to toggle source

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
new(*args) click to toggle source

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
new(path) click to toggle source

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

Public Instance Methods

invalid?() click to toggle source
# File lib/backup/syncer/cloud/local_file.rb, line 78
def invalid?
  !!@invalid
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.