Skip to content
Browse files

Refactor ActionDispatch::Http::UploadedFile

  • Loading branch information...
1 parent bb4dedb commit 62a61add7e7555aae80660f3694e09624be192f3 @dasch dasch committed Aug 28, 2011
Showing with 3 additions and 14 deletions.
  1. +3 −14 actionpack/lib/action_dispatch/http/upload.rb
View
17 actionpack/lib/action_dispatch/http/upload.rb
@@ -11,24 +11,13 @@ def initialize(hash)
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

0 comments on commit 62a61ad

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