Class: S3diff::LocalFile
- Inherits:
-
Object
- Object
- S3diff::LocalFile
- Defined in:
- lib/s3diff/local_file.rb
Instance Method Summary collapse
- #etag ⇒ Object
- #exist? ⇒ Boolean
-
#initialize(file_path) ⇒ LocalFile
constructor
A new instance of LocalFile.
- #original_path ⇒ Object
- #path ⇒ Object
- #size ⇒ Object
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
#etag ⇒ Object
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
29 30 31 |
# File 'lib/s3diff/local_file.rb', line 29 def exist? File.exist?(@file_path) end |
#original_path ⇒ Object
25 26 27 |
# File 'lib/s3diff/local_file.rb', line 25 def original_path @file_path end |
#path ⇒ Object
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 |
#size ⇒ Object
13 14 15 |
# File 'lib/s3diff/local_file.rb', line 13 def size File.size(@file_path) if exist? end |