Sha256: fb77b372f6f8fbe47f760cb26e5ea7764cebf70037d4c7c96da7ed65e89f9dbd
Contents?: true
Size: 1.03 KB
Versions: 24
Compression:
Stored size: 1.03 KB
Contents
module ActionDispatch module Http class UploadedFile attr_accessor :original_filename, :content_type, :tempfile, :headers 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 def open @tempfile.open end def path @tempfile.path end def read(*args) @tempfile.read(*args) end def rewind @tempfile.rewind end def size @tempfile.size end end module Upload # Convert nested Hash to HashWithIndifferentAccess and replace # file upload hash with UploadedFile objects def normalize_parameters(value) if Hash === value && value.has_key?(:tempfile) UploadedFile.new(value) else super end end private :normalize_parameters end end end
Version data entries
24 entries across 24 versions & 1 rubygems