Sha256: f12294aad836141862dfbaac364ea2d27a9babba881ae49893ee3ff9ed9716f0
Contents?: true
Size: 995 Bytes
Versions: 2
Compression:
Stored size: 995 Bytes
Contents
# frozen_string_literal: true require_relative '../circleci_reporter' require_relative 'client' require_relative 'configuration' module CircleCIReporter # A sandbox isolates the enclosed code into an environment that looks 'new' # meaning globally accessed objects are reset for the duration of the sandbox. # # @note This module is not normally available. You must require # `circleci_reporter/sandbox` to load it. module Sandbox # Execute a provided block with CircleCIReporter global objects( # configuration, client) reset. # # @yield [Configuration] # @return [void] def self.sandboxed orig_config = CircleCIReporter.configuration orig_client = CircleCIReporter.client CircleCIReporter.configuration = Configuration.new CircleCIReporter.client = Client.new yield CircleCIReporter.configuration ensure CircleCIReporter.configuration = orig_config CircleCIReporter.client = orig_client end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
circleci_reporter-1.0.1 | lib/circleci_reporter/sandbox.rb |
circleci_reporter-1.0.0 | lib/circleci_reporter/sandbox.rb |