Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refactor ActionDispatch::Http::UploadedFile

  • Loading branch information...
commit 62a61add7e7555aae80660f3694e09624be192f3 1 parent bb4dedb
Daniel Schierbeck authored August 28, 2011
17  actionpack/lib/action_dispatch/http/upload.rb
@@ -11,24 +11,13 @@ def initialize(hash)
11 11
         raise(ArgumentError, ':tempfile is required') unless @tempfile
12 12
       end
13 13
 
14  
-      def open
15  
-        @tempfile.open
16  
-      end
17  
-
18  
-      def path
19  
-        @tempfile.path
20  
-      end
21  
-
22 14
       def read(*args)
23 15
         @tempfile.read(*args)
24 16
       end
25 17
 
26  
-      def rewind
27  
-        @tempfile.rewind
28  
-      end
29  
-
30  
-      def size
31  
-        @tempfile.size
  18
+      # Delegate these methods to the tempfile.
  19
+      [:open, :path, :rewind, :size].each do |method|
  20
+        class_eval "def #{method}; @tempfile.#{method}; end"
32 21
       end
33 22
       
34 23
       private

0 notes on commit 62a61ad

Please sign in to comment.
Something went wrong with that request. Please try again.