class S3diff::LocalFile

Public Class Methods

new(file_path) click to toggle source
# File lib/s3diff/local_file.rb, line 5
def initialize(file_path)
  @file_path = file_path
end

Public Instance Methods

etag() click to toggle source
# File lib/s3diff/local_file.rb, line 9
def etag
  Digest::MD5.file(@file_path).to_s if exist?
end
exist?() click to toggle source
# File lib/s3diff/local_file.rb, line 29
def exist?
  File.exist?(@file_path)
end
original_path() click to toggle source
# File lib/s3diff/local_file.rb, line 25
def original_path
  @file_path
end
path() click to toggle source
# File lib/s3diff/local_file.rb, line 17
def path
  if exist?
    original_path
  else
    cache_file.path
  end
end
size() click to toggle source
# File lib/s3diff/local_file.rb, line 13
def size
  File.size(@file_path) if exist?
end

Private Instance Methods

cache_file() click to toggle source
# File lib/s3diff/local_file.rb, line 35
def cache_file
  @cache_file ||= begin
    Tempfile.new("")
  end
end