Created
May 6, 2009 16:27
-
-
Save oleganza/107593 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I wonder why we still use File instance monkey-patching | |
# instead of a regular subclass/delegator? | |
# Every time you test uploaded files, you come up with a brand-new mock. | |
# Duh... | |
class UploadedFile < Delegator | |
attr_accessor :file, :mime_type, :original_filename | |
def initialize(file, mime_type, original_filename) | |
super(file) | |
@file = file | |
@mime_type = mime_type | |
@original_filename = original_filename | |
# ... | |
end | |
def __getobj__; @file; end # required by Delegator | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment