class UploadHelpers::Http::UploadedFile

Create tempfile from hash

Attributes

content_type[RW]
headers[RW]
original_filename[RW]
tempfile[RW]

Public Class Methods

new(hash) click to toggle source
# File lib/virgo/upload_helpers.rb, line 11
def initialize(hash)
  @original_filename = hash[:filename]
  @content_type      = hash[:type]
  @headers           = hash[:head]
  @tempfile          = hash[:tempfile]
  raise(ArgumentError, ':tempfile is required') unless @tempfile
end

Public Instance Methods

open() click to toggle source
# File lib/virgo/upload_helpers.rb, line 19
def open
  @tempfile.open
end
path() click to toggle source
# File lib/virgo/upload_helpers.rb, line 23
def path
  @tempfile.path
end
read(*args) click to toggle source
# File lib/virgo/upload_helpers.rb, line 27
def read(*args)
  @tempfile.read(*args)
end
rewind() click to toggle source
# File lib/virgo/upload_helpers.rb, line 31
def rewind
  @tempfile.rewind
end
size() click to toggle source
# File lib/virgo/upload_helpers.rb, line 35
def size
  @tempfile.size
end