class Bootsnap::LoadPathCache::RealpathCache

def call(*key)

def call(*key)
  @cache[key]
end

def find_file(name)

def find_file(name)
  ['', *CACHED_EXTENSIONS].each do |ext|
    filename = "#{name}#{ext}"
    return File.realpath(filename) if File.exist?(filename)
  end
  name
end

def initialize

def initialize
  @cache = Hash.new { |h, k| h[k] = realpath(*k) }
end

def realpath(caller_location, path)

def realpath(caller_location, path)
  base = File.dirname(caller_location)
  file = find_file(File.expand_path(path, base))
  dir = File.dirname(file)
  File.join(dir, File.basename(file))
end