Sha256: 1800392e8625616e22d8eca613817dd373c4d11a487186bd0f5c611978586ffe

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

require "filezor/util"
# A File that knows its MD5 hash, and target upload path.
class Filezor::File  
  attr_accessor :tempfile, :md5, :path
  
  module Pathable
    def path; ""; end
  end
  
  def initialize(tempfile, path, hash = nil)
    @tempfile = tempfile
    
    # for ruby 1.9 compat.  Restclient duck-types files on path
    @tempfile.extend(Pathable) unless @tempfile.respond_to?(:path)
    
    @path = path
    @md5 = hash || Filezor::Util::md5(tempfile)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filezor-1.3.5 lib/filezor/file.rb