class Grape::Validations::Types::File
this class is here only to assert that rack’s handling has succeeded.
Actual handling of these objects is provided by Rack::Request
;
Implementation for parameters that are multipart file objects.
def parse(input)
def parse(input) return if input.nil? return InvalidValue.new unless parsed?(input) # Processing of multipart file objects # is already taken care of by Rack::Request. # Nothing to do here. input end
def parsed?(value)
def parsed?(value) # Rack::Request creates a Hash with filename, # content type and an IO object. Do a bit of basic # duck-typing. value.is_a?(::Hash) && value.key?(:tempfile) && value[:tempfile].is_a?(Tempfile) end