Class: S3diff::LocalFile

Inherits:
Object
  • Object
show all
Defined in:
lib/s3diff/local_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ LocalFile

Returns a new instance of LocalFile.



5
6
7
# File 'lib/s3diff/local_file.rb', line 5

def initialize(file_path)
  @file_path = file_path
end

Instance Method Details

#etagObject



9
10
11
# File 'lib/s3diff/local_file.rb', line 9

def etag
  Digest::MD5.file(@file_path).to_s if exist?
end

#exist?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/s3diff/local_file.rb', line 29

def exist?
  File.exist?(@file_path)
end

#original_pathObject



25
26
27
# File 'lib/s3diff/local_file.rb', line 25

def original_path
  @file_path
end

#pathObject



17
18
19
20
21
22
23
# File 'lib/s3diff/local_file.rb', line 17

def path
  if exist?
    original_path
  else
    cache_file.path
  end
end

#sizeObject



13
14
15
# File 'lib/s3diff/local_file.rb', line 13

def size
  File.size(@file_path) if exist?
end