source: subversion/sites/rails_port/config/initializers/tempfile.rb @ 8124

Last change on this file since 8124 was 7041, checked in by tomhughes, 11 years ago

Work round ruby's half assed Tempfile class which, because for some
reason it is implemented by delegating to File (by inheriting from
DelegateClass?(File)) rather than by inheriting from it, does not
actually look like a File, and hence does not look like an IO (in
that it does not respond to kind_of? IO calls).

In ruby 1.8.5 this doesn't matter as REXML checks that the source
it has been given responds to the methods it wants (using respond_to?
which is handled properly by DelegateClass?) but in 1.8.4 which we
are running on rails2 REXML uses kind_of? to see if the source is
one it can use.

File size: 181 bytes
Line 
1# Hack TempFile to let us get at the underlying File object as ruby
2# does a half assed job of making TempFile act as a File
3class Tempfile
4  def file
5    return @tmpfile
6  end
7end
Note: See TracBrowser for help on using the repository browser.