class method
self.new
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
self.new(path, content_type = Mime::TEXT, binary = false)
No documentation comment.
Parameters
-
pathreq -
content_typeopt = Mime::TEXT -
binaryopt = false
Source
# File actionpack/lib/action_controller/test_process.rb, line 348
def initialize(path, content_type = Mime::TEXT, binary = false)
raise "#{path} file does not exist" unless File.exist?(path)
@content_type = content_type
@original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 }
@tempfile = Tempfile.new(@original_filename)
@tempfile.set_encoding(Encoding::BINARY) if @tempfile.respond_to?(:set_encoding)
@tempfile.binmode if binary
FileUtils.copy_file(path, @tempfile.path)
end
Defined in actionpack/lib/action_controller/test_process.rb line 348
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::TestUploadedFile