diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-28 09:52:54 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-28 09:52:54 -0700 |
commit | e145acd6f16cd039613cb1bcadc18b31b54c91de (patch) | |
tree | 0acf261a1b1ad92e5da278a4063f3c948cde9a17 | |
parent | bb4dedbc2cc7b96b95bf4519f56ed9624949a7ef (diff) | |
parent | 62a61add7e7555aae80660f3694e09624be192f3 (diff) | |
download | rails-e145acd6f16cd039613cb1bcadc18b31b54c91de.tar.gz rails-e145acd6f16cd039613cb1bcadc18b31b54c91de.tar.bz2 rails-e145acd6f16cd039613cb1bcadc18b31b54c91de.zip |
Merge pull request #2711 from dasch/patch-3
Refactor ActionDispatch::Http::UploadedFile
-rw-r--r-- | actionpack/lib/action_dispatch/http/upload.rb | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb index a15ad28f16..94fa747a79 100644 --- a/actionpack/lib/action_dispatch/http/upload.rb +++ b/actionpack/lib/action_dispatch/http/upload.rb @@ -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 |