Sha256: 0d2bd674c388f43e8c1e7000775bcbbf40b7edb8d3725b7059fee3cc10a64e3d

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 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

1 entries across 1 versions & 1 rubygems

Version Path
multi_sync-0.0.2 lib/multi_sync/resources/local_resource.rb