Runs before_dispatch in all plugins.

 @param env [Hash]
 @return [Hash]
483482
def plugin_before_dispatch(env)
      new_env = env

      self.plugins.each do |plugin|
        if plugin.respond_to? :before_dispatch
          new_env = plugin.send(:before_dispatch, self, env)
        end
      end

      new_env
    end
585867
def call(env)
      @start = Time.now
      GC.clear_stats if @track_gc

      @total_requests += 1
      first_request if @total_requests == 1

      env['process.request_start'] = @start.to_f
      env['process.total_requests'] = total_requests

      # newrelic X-Request-Start
      env.delete('HTTP_X_REQUEST_START')

      status, headers, body = @app.call(env)
      body = Body.new(body) { record_request(status, env) }
      [status, headers, body]
    end
278704
def execute_internal(args = [], **options)
      options = {
        output: :default,
        environment: :cli
      }.merge(options)
      @runner.execute(args, options)
    end
269476
def call(env)
      context = { request: ActionDispatch::Request.new(env) }
      sequence = build_sequence(@root_item, context)
      chain = build_request_chain(sequence, context)

      event = build_event(context)

      publish_start(event.dup)
      instrumented_call(event) do
        begin
          response = chain.instrument.call
        ensure
          # We want to populate the response and metadata fields after the middleware
          # chain has completed so that the end of the instrumentation can see them. The
          # simplest way to do this is pass the event by reference to ActiveSupport, then
          # modify the hash to contain this detail before the instrumentation completes.
          #
          # This way, the last finish_handler.coach event will have all the details.
          status = response.try(:first) || STATUS_CODE_FOR_EXCEPTIONS
          event.merge!(
            response: { status: status },
            metadata: context.fetch(:_metadata, {}),
          )
        end
      end
    end
1226806
def call(env)
      req = Rack::Request.new(env)
      status, headers, response = @app.call(env)

      config = SecureHeaders.config_for(req)
      flag_cookies!(headers, override_secure(env, config.cookies)) unless config.cookies == OPT_OUT
      headers.merge!(SecureHeaders.header_hash_for(req))
      [status, headers, response]
    end
1017443
def _perform(environment)
      res = ""
      before = @before.perform(environment)
      res << before.value
      mid = @mid.perform(environment)
      res << (mid.is_a?(Sass::Script::Value::String) ? mid.value : mid.to_s(:quote => :none))
      res << @after.perform(environment).value
      opts(Sass::Script::Value::String.new(res, before.type))
    end
1248739
def stub_env_config(inst, hash = nil)
      (hash = inst; inst = nil) if inst.is_a?(Hash)
      inst = @env || env unless inst

      hash = Jekyll::Utils.deep_merge_hashes(inst.asset_config, hash)
      allow(inst).to receive(:asset_config).and_return(hash)
    end
348181
def pre_init():
    

    logger.info("Run pre-initiation hook of {} plugin.".format(__file__.split(os.path.sep)[-2]))

    # Example: Monkey-Path rafcon.core.script.Script class to print additional log-message while execution
    from rafcon.core.script import Script
    old_execute_method = Script.execute

    def new_execute_method(self, state, inputs=None, outputs=None, backward_execution=False):
        logger.debug("patched version of Script class is used.")
        result = old_execute_method(self, state, inputs, outputs, backward_execution)
        logger.debug("patched version of Script execute-method is finished with result: {}.".format(result))
        return result

    Script.execute = new_execute_method
680826
public function envHalt()
    {
        $this->executeCommandHook(__FUNCTION__, 'before');
        $this->engineInstance()->suspend();
        $this->executeCommandHook(__FUNCTION__, 'after');
    }
1363208
def environment(variables)
      before do
        variables.each do |key, value|
          if value.nil?
            _environment.delete(key.to_s)
          else
            _environment[key.to_s] = value.to_s
          end
        end
      end
    end
1215067
def call(env)
      @app.call(env).on_complete do |response_env|
        datetime = sunset_header(response_env.response_headers)
        report_deprecated_usage(env, datetime) unless datetime.nil?
      end
    end
484262
def call(env)
			@app.call(env) if @app.respond_to? :call
			Flame::Dispatcher.new(self.class, env).run!
		end
806674
function( name, testEnvironment ) {
		var currentModule = {
			name: name,
			testEnvironment: testEnvironment,
			tests: []
		};

		// DEPRECATED: handles setup/teardown functions,
		// beforeEach and afterEach should be used instead
		if ( testEnvironment && testEnvironment.setup ) {
			testEnvironment.beforeEach = testEnvironment.setup;
			delete testEnvironment.setup;
		}
		if ( testEnvironment && testEnvironment.teardown ) {
			testEnvironment.afterEach = testEnvironment.teardown;
			delete testEnvironment.teardown;
		}

		config.modules.push( currentModule );
		config.currentModule = currentModule;
	}
915668
def pre_process(classes_hash, opts)
      Process::IgnoredClasses.new(classes_hash).process_all!
      Process::GlobalMembers.new(classes_hash, opts).process_all!
      Process::Accessors.new(classes_hash).process_all!
      Process::Ext4Events.new(classes_hash, opts).process_all!
      Process::Enums.new(classes_hash).process_all!
      Process::Overrides.new(classes_hash, opts).process_all!

      classes_hash.values
    end
572713
function RunnerContext(argv, config, env) {
  argv.tasks = argv._.length ? argv._ : ['default'];
  this.argv = argv;
  this.config = config;
  this.env = env;
  this.json = loadConfig(this.argv.cwd, this.env);
  this.pkg = loadPkg(this.argv.cwd, this.env);
  this.pkgConfig = this.pkg[env.name] || {};
  this.options = merge({}, this.pkgConfig.options, this.json.options);
}
29882
public static function run($rootDirectory = '.', $env = null, $uri = null, $dispatch = true)
    {
        self::$rootDirectory = $rootDirectory;

        // wrap the whole app inside a try/catch block to catch all errors
        try {
        
            // config & environment
            try {
                self::set(self::loadConfig(self::path(self::get('atomik.files.config'), null, false), false));
            } catch (AtomikException $e) {}
            
            $env = $env ?: (defined('ATOMIK_ENV') ? ATOMIK_ENV : null);
            if ($env !== null && self::has($env)) {
                self::set(self::get($env));
            }
            
            self::fireEvent('Atomik::Config');
            
            // sets the error reporting to all errors if debug mode is on
            if (self::get('atomik.debug', false) == true) {
                error_reporting(E_ALL | E_STRICT);
            }

            // makes relative include dirs relative to app root
            self::set('atomik.dirs.includes', self::path(self::get('atomik.dirs.includes', array())));
            
            // registers the class autoload handler
            if (self::get('atomik.class_autoload', true) == true) {
                if (!function_exists('spl_autoload_register')) {
                    throw new AtomikException("Missing 'spl_autoload_register()' function");
                }
                spl_autoload_register('Atomik::needed');
            }
        
            // cleans the plugins array
            $plugins = array();
            foreach (self::get('plugins', array()) as $key => $value) {
                if (!is_string($key)) {
                    $key = $value;
                    $value = array();
                }
                $plugins[ucfirst($key)] = (array) $value;
            }
            self::set('plugins', $plugins, false);
            
            // loads plugins
            // this method allows plugins that are being loaded to modify the plugins array
            $loadedPlugins = array();
            while (count($pluginsToLoad = array_diff(array_keys(self::get('plugins')), 
                self::getLoadedPlugins(), $loadedPlugins)) > 0) {
                    foreach ($pluginsToLoad as $plugin) {
                        if (self::loadPlugin($plugin) === false) {
                            $loadedPlugins[] = $plugin;
                        }
                    }
            }
            
            self::fireEvent('Atomik::Bootstrap');
            if ($filename = self::path(self::get('atomik.files.bootstrap'))) {
                include $filename;
            }
        
            $cancel = false;
            self::fireEvent('Atomik::Start', array(&$cancel));
            if ($cancel) {
                self::end(true);
            }
        
            if (!self::has('atomik.url_rewriting')) {
                self::set('atomik.url_rewriting', 
                    isset($_SERVER['REDIRECT_URL']) || isset($_SERVER['REDIRECT_URI']));
            }
            
            if ($dispatch) {
                self::dispatch($uri);
                self::end(true);
            }
            
        } catch (Exception $e) {
            $cancel = false;
            self::fireEvent('Atomik::Error', array($e, &$cancel));
            if (!$cancel) {
                throw $e;
            }
        }
    }
774663
def call_env_updated(cls, kb_app,
                         sphinx_app: Sphinx,
                         sphinx_env: BuildEnvironment):

        
        for callback in EventAction.get_callbacks(kb_app, SphinxEvent.EU):
            callback(kb_app, sphinx_app, sphinx_env)