brew/Library/Homebrew/extend/cachable.rb
apainintheneck 5cc1c85a5f cachable: Move registry to test directory
Now we only include the cachable registry when running tests.
We basically just load it first and add a bunch of methods to
it before loading the rest of the formula files when we require
global.rb. I added a check to make sure this require order is
preserved.

I also made a bunch of methods private, stop excluding classes
that inherit from casks since it's unnecessary and add more docs.
2024-02-26 20:41:10 -08:00

15 lines
257 B
Ruby

# typed: strict
# frozen_string_literal: true
module Cachable
sig { returns(T::Hash[T.untyped, T.untyped]) }
def cache
@cache ||= T.let({}, T.nilable(T::Hash[T.untyped, T.untyped]))
end
sig { void }
def clear_cache
cache.clear
end
end