Method: #uncache

Defined in:
lib/crazy_ivan/vendor/lockfile-1.4.3/samples/a.rb

#uncache(file) ⇒ Object

}}}



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/crazy_ivan/vendor/lockfile-1.4.3/samples/a.rb', line 37

def uncache file 
#{{{
  refresh = nil
  begin
    is_a_file = File === file
    path = (is_a_file ? file.path : file.to_s) 
    stat = (is_a_file ? file.stat : File.stat(file.to_s)) 
    refresh = tmpnam(File.dirname(path))
    File.link path, refresh rescue File.symlink path, refresh
    File.chmod stat.mode, path
    File.utime stat.atime, stat.mtime, path
  ensure 
    begin
      File.unlink refresh if refresh
    rescue Errno::ENOENT
    end
  end
#}}}
end