Sha256: 6af1be0db009bc5ec770f2977b66480c4f95c3cc6c722534892613c8565468b2
Contents?: true
Size: 702 Bytes
Versions: 46
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true require 'active_support' require 'active_support/per_thread_registry' module LHS module OptionBlocks extend ActiveSupport::Concern class CurrentOptionBlock # Using ActiveSupports PerThreadRegistry to be able to support Active Support v4. # Will switch to thread_mattr_accessor (which comes with Activesupport) when we dropping support for Active Support v4. extend ActiveSupport::PerThreadRegistry attr_accessor :options end module ClassMethods def options(options, &block) CurrentOptionBlock.options = options block.call ensure CurrentOptionBlock.options = nil end end end end
Version data entries
46 entries across 46 versions & 1 rubygems