Sha256: e7d2126158685cd89ec3aea48c2d099d769e0a09ae09a60ef150462e5cf13168

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

require 'multi_sync/resource'

module MultiSync
  class RemoteResource < Resource
    def initialize(options = {})
      self.file = options.fetch(:file, nil)
      super(options)
    end

    def body
      file.body
    end

    def determine_etag
      file.etag
    rescue NoMethodError # Fog::Storage::Local::File's don't have an etag method :(
      Digest::MD5.hexdigest(File.read(path_with_root))
    end

    def determine_mtime
      file.last_modified
    end

    def determine_content_type
      file.content_type
    end

    def determine_content_length
      file.content_length
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_sync-0.0.1 lib/multi_sync/resources/remote_resource.rb