Sha256: f4cf5c957de1c8d10ae7ad6dce6b64e7c008d49a1c6238082bc63c1ba9dd1acc
Contents?: true
Size: 928 Bytes
Versions: 1
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true require 'active_support/all' require 'active_record' require 'goldiloader/compatibility' require 'goldiloader/auto_include_context' require 'goldiloader/scope_info' require 'goldiloader/association_options' require 'goldiloader/association_loader' require 'goldiloader/active_record_patches' module Goldiloader class << self # Sets the process-wide enabled status attr_accessor :globally_enabled def enabled? Thread.current.fetch(:goldiloader_enabled, globally_enabled) end def enabled=(val) Thread.current[:goldiloader_enabled] = val end def enabled old_enabled = enabled? self.enabled = true yield ensure self.enabled = old_enabled end def disabled old_enabled = enabled? self.enabled = false yield ensure self.enabled = old_enabled end end self.globally_enabled = true end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
goldiloader-4.1.0 | lib/goldiloader.rb |