mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge pull request #2711 from dasch/patch-3
Refactor ActionDispatch::Http::UploadedFile
This commit is contained in:
@@ -11,24 +11,13 @@ module ActionDispatch
|
||||
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
|
||||
# Delegate these methods to the tempfile.
|
||||
[:open, :path, :rewind, :size].each do |method|
|
||||
class_eval "def #{method}; @tempfile.#{method}; end"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user