Module: Sunrise::FileUpload::Http

Defined in:
lib/sunrise/file_upload/http.rb

Defined Under Namespace

Classes: QqFile, UploadedFile

Class Method Summary collapse

Class Method Details

.normalize_param(*args) ⇒ Object

Convert nested Hash to HashWithIndifferentAccess and replace file upload hash with UploadedFile objects



71
72
73
74
75
76
77
78
# File 'lib/sunrise/file_upload/http.rb', line 71

def self.normalize_param(*args)
  value = args.first
  if Hash === value && value.has_key?(:tempfile)
    UploadedFile.new(value)
  elsif value.is_a?(String)
    QqFile.new(*args)
  end
end