class Bootsnap::LoadPathCache::RealpathCache
Public Class Methods
new()
click to toggle source
# File lib/bootsnap/load_path_cache/realpath_cache.rb, line 5 def initialize @cache = Hash.new { |h, k| h[k] = realpath(*k) } end
Public Instance Methods
call(*key)
click to toggle source
# File lib/bootsnap/load_path_cache/realpath_cache.rb, line 9 def call(*key) @cache[key] end
Private Instance Methods
find_file(name)
click to toggle source
# File lib/bootsnap/load_path_cache/realpath_cache.rb, line 22 def find_file(name) ['', *CACHED_EXTENSIONS].each do |ext| filename = "#{name}#{ext}" return File.realpath(filename) if File.exist?(filename) end name end
realpath(caller_location, path)
click to toggle source
# File lib/bootsnap/load_path_cache/realpath_cache.rb, line 15 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