From 62a61add7e7555aae80660f3694e09624be192f3 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Sun, 28 Aug 2011 07:24:58 +0300 Subject: Refactor ActionDispatch::Http::UploadedFile --- actionpack/lib/action_dispatch/http/upload.rb | 17 +++-------------- 1 file 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 -- cgit v1.2.3