Class: MultiSync::LocalResource
- Inherits:
-
Resource
- Object
- Resource
- MultiSync::LocalResource
show all
- Defined in:
- lib/multi_sync/resources/local_resource.rb
Constant Summary
Constants inherited
from Resource
Resource::AWS_ATTRIBUTES
Instance Method Summary
collapse
Methods inherited from Resource
#<=>, #==, #hash, #initialize, #matching_etag?
Instance Method Details
#body ⇒ Object
6
7
8
9
10
|
# File 'lib/multi_sync/resources/local_resource.rb', line 6
def body
File.read(path_with_root.to_s)
rescue
return nil
end
|
#determine_content_length ⇒ Object
26
27
28
|
# File 'lib/multi_sync/resources/local_resource.rb', line 26
def determine_content_length
body.nil? ? 0 : Fog::Storage.get_body_size(body)
end
|
#determine_content_type ⇒ Object
22
23
24
|
# File 'lib/multi_sync/resources/local_resource.rb', line 22
def determine_content_type
MultiMime.type_for_path(path_with_root.to_s)
end
|
#determine_etag ⇒ Object
12
13
14
|
# File 'lib/multi_sync/resources/local_resource.rb', line 12
def determine_etag
body.nil? ? nil : Digest::MD5.hexdigest(body)
end
|
#determine_mtime ⇒ Object
16
17
18
19
20
|
# File 'lib/multi_sync/resources/local_resource.rb', line 16
def determine_mtime
File.mtime(path_with_root.to_s)
rescue
return nil
end
|