Class: Spider::UploadedFile

Inherits:
Tempfile
  • Object
show all
Defined in:
lib/spiderfw/http/http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, content_type, encoding) ⇒ UploadedFile

Returns a new instance of UploadedFile.



323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/spiderfw/http/http.rb', line 323

def initialize(filename, content_type, encoding)
    @filename = filename
    @content_type = content_type
    @encoding = encoding
    if RUBY_VERSION =~ /^1.9.3/
        super('uploaded', Spider.paths[:tmp], content_type, :encoding => encoding)
    elsif RUBY_VERSION =~ /^1.8.7/ #caso con ruby 1.8.7
        super('uploaded', Spider.paths[:tmp])
    else
        super('uploaded', Spider.paths[:tmp], :encoding => encoding)
    end
end

Instance Attribute Details

#content_typeObject (readonly)

aggiunto encoding per problemi con upload file “xFF” from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)



321
322
323
# File 'lib/spiderfw/http/http.rb', line 321

def content_type
  @content_type
end

#encodingObject (readonly)

aggiunto encoding per problemi con upload file “xFF” from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)



321
322
323
# File 'lib/spiderfw/http/http.rb', line 321

def encoding
  @encoding
end

#filenameObject (readonly)

aggiunto encoding per problemi con upload file “xFF” from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)



321
322
323
# File 'lib/spiderfw/http/http.rb', line 321

def filename
  @filename
end