Parent

Class/Module Index [+]

Quicksearch

Backup::Syncer::Cloud::Base::LocalFile

Attributes

md5[R]
path[R]
relative_path[R]

Public Class Methods

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/base.rb, line 196
def self.new(*args)
  local_file = super(*args)
  if local_file.invalid?
    Logger.warn(
      "\s\s[skipping] #{ local_file.path }\n" +
      "\s\sPath Contains Invalid UTF-8 byte sequences"
    )
    return nil
  end
  local_file
end
new(directory, line) click to toggle source

Creates a new LocalFile object using the given directory and line from the md5 hash checkup. This object figures out the path, relative_path and md5 hash for the file.

# File lib/backup/syncer/cloud/base.rb, line 212
def initialize(directory, line)
  @invalid = false
  @directory = sanitize(directory)
  line = sanitize(line).chomp
  @path = line.slice(4..-36)
  @md5 = line.slice(-32..-1)
  @relative_path = @path.sub(@directory + '/', '')
end

Public Instance Methods

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.