ruby-win32/lib/ruby/site_ruby/1.8/rubygems/source_info_cache.rb
def try_file(fn)
    return fn if File.writable?(fn)
    return nil if File.exist?(fn)
    dir = File.dirname(fn)
    unless File.exist? dir then
      begin
        FileUtils.mkdir_p(dir)
      rescue RuntimeError, SystemCallError
        return nil
      end
    end
    if File.writable?(dir)
      File.open(fn, "wb") { |f| f << Marshal.dump({}) }
      return fn
    end
    nil
  end
# Determine if +fn+ is a candidate for a cache file.  Return fn if
# it is.  Return nil if it is not.
Determine if +fn+ is a candidate for a cache file.  Return fn if
it is.  Return nil if it is not.
Determine if + fn + is a candidate for a cache file . Return fn if it is . Return nil if it is not .
def try_file(fn)
    return fn if File.writable?(fn)
    return nil if File.exist?(fn)
    dir = File.dirname(fn)
    unless File.exist? dir then
      begin
        FileUtils.mkdir_p(dir)
      rescue RuntimeError, SystemCallError
        return nil
      end
    end
    if File.writable?(dir)
      File.open(fn, "wb") { |f| f << Marshal.dump({}) }
      return fn
    end
    nil
  end
def try_file ( fn ) return fn if File . writable? ( fn ) return nil if File . exist? ( fn ) dir = File . dirname ( fn ) unless File . exist? dir then begin FileUtils . mkdir_p ( dir ) rescue RuntimeError , SystemCallError return nil end end if File . writable? ( dir ) File . open ( fn , "wb" ) { | f | f << Marshal . dump ( { } ) } return fn end nil end
Determine if +fn+ is a candidate for a cache file.
Determine if + fn + is a candidate for a cache file .
fn