Sha256: 77c44c1a2baf0578b2fa12e6728b9c2a039e9891fd501b83a66a335f63043d28
Contents?: true
Size: 536 Bytes
Versions: 9
Compression:
Stored size: 536 Bytes
Contents
# frozen_string_literal: true module ArLazyPreload module Contexts # Preload config that used to enable preloading only for specfic part of the application class TemporaryPreloadConfig THREAD_KEY = "temporary_preload_context_enabled" class << self def enabled? Thread.current[THREAD_KEY] == true end def within_context Thread.current[THREAD_KEY] = true yield ensure Thread.current[THREAD_KEY] = nil end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems