class Bootsnap::LoadPathCache::LoadedFeaturesIndex

def initialize

def initialize
  @lfi = {}
  @mutex = defined?(::Mutex) ? ::Mutex.new : ::Thread::Mutex.new # TODO: Remove once Ruby 2.2 support is dropped.
  # In theory the user could mutate $LOADED_FEATURES and invalidate our
  # cache. If this ever comes up in practice — or if you, the
  # enterprising reader, feels inclined to solve this problem — we could
  # parallel the work done with ChangeObserver on $LOAD_PATH to mirror
  # updates to our @lfi.
  $LOADED_FEATURES.each do |feat|
    hash = feat.hash
    $LOAD_PATH.each do |lpe|
      next unless feat.start_with?(lpe)
      # /a/b/lib/my/foo.rb
      #          ^^^^^^^^^
      short = feat[(lpe.length + 1)..-1]
      stripped = strip_extension(short)
      @lfi[short] = hash
      @lfi[stripped] = hash
    end
  end
end