From: pachl Date: 2006-12-09T22:10:09+09:00 Subject: Dynamically Create Singleton Method I'm not sure how to explain what I'm looking for so I will show you: # this works, but not quite the functionality I need def simulate_cgi_upload class << cgi_file = Tempfile.new('simulate-cgi') def content_type() 'image/jpeg' end end cgi_file end # this does NOT work, but has the functionality I need # i.e.: dynamically defining content_type's return value using # the argument from simulate_cgi_upload method. def simulate_cgi_upload(mime_type = 'image/jpeg') class << cgi_file = Tempfile.new('simulate-cgi') def content_type() mime_type end end cgi_file end -pachl