mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Refactor ActionDispatch::Http::UploadedFile
This commit is contained in:
parent
bb4dedbc2c
commit
62a61add7e
1 changed files with 3 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue