Sha256: c9fcda74e15199a17d1d92d33b822e2a6012943ad278a6bcd2016768110d23d9
Contents?: true
Size: 984 Bytes
Versions: 5
Compression:
Stored size: 984 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 = Thread.current[:goldiloader_enabled] self.enabled = true yield ensure self.enabled = old_enabled end def disabled old_enabled = Thread.current[:goldiloader_enabled] self.enabled = false yield ensure self.enabled = old_enabled end end self.globally_enabled = true end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
goldiloader-4.2.1 | lib/goldiloader.rb |
goldiloader-5.0.0 | lib/goldiloader.rb |
goldiloader-4.2.0 | lib/goldiloader.rb |
goldiloader-4.1.2 | lib/goldiloader.rb |
goldiloader-4.1.1 | lib/goldiloader.rb |