Sha256: 4cf8341802f83dd6894816732d8bbbaf76e557c79ec9773c2cd0aa0698ca0fb3

Contents?: true

Size: 295 Bytes

Versions: 1

Compression:

Stored size: 295 Bytes

Contents

module ConfigManager
	class ToggleIdentityMap
		@thread_map = {}

		class << self
			def reset_id_map
				@thread_map[Thread.current.object_id] = {}
			end

			def id_map
				@thread_map[Thread.current.object_id] ||= {}
			end

			def value(key)
				id_map[:key] ||= yield
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
config_manager-1.0.3 lib/config_manager/toggle_identity_map.rb