Sha256: 473b9910fc83c639875cde3c84f7b316d086235beb3c0ecef53198225e2d1efb

Contents?: true

Size: 569 Bytes

Versions: 3

Compression:

Stored size: 569 Bytes

Contents

require 'multi_mime'
require 'multi_sync/resource'

module MultiSync
  class LocalResource < Resource
    def body
      File.read(path_with_root.to_s)
    rescue
      return nil
    end

    def determine_etag
      body.nil? ? nil : Digest::MD5.hexdigest(body)
    end

    def determine_mtime
      File.mtime(path_with_root.to_s)
    rescue
      return nil
    end

    def determine_content_type
      MultiMime.type_for_path(path_with_root.to_s)
    end

    def determine_content_length
      body.nil? ? 0 : Fog::Storage.get_body_size(body)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
multi_sync-0.0.4 lib/multi_sync/resources/local_resource.rb
multi_sync-0.0.3 lib/multi_sync/resources/local_resource.rb
multi_sync-0.0.1 lib/multi_sync/resources/local_resource.rb