Module: Bootsnap::LoadPathCache::CoreExt::ActiveSupport

Defined in:
lib/bootsnap/load_path_cache/core_ext/active_support.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.with_bootsnap_fallback(error) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/bootsnap/load_path_cache/core_ext/active_support.rb', line 5

def self.with_bootsnap_fallback(error)
  yield
rescue error => e
  # NoMethodError is a NameError, but we only want to handle actual
  # NameError instances.
  raise unless e.class == error
  without_bootsnap_cache { yield }
end

.without_bootsnap_cacheObject



14
15
16
17
18
19
20
# File 'lib/bootsnap/load_path_cache/core_ext/active_support.rb', line 14

def self.without_bootsnap_cache
  prev = Thread.current[:without_bootsnap_cache] || false
  Thread.current[:without_bootsnap_cache] = true
  yield
ensure
  Thread.current[:without_bootsnap_cache] = prev
end