public function initializeRulesets(array $configuration)
    {
        $general = $configuration;
        $general['usergroup'] = '';
        unset($general['rulesets']);
        $general = $this->expandValuesInRuleset($general);
        if ($general['conversion_mapping'] === '') {
            $general['conversion_mapping'] = [];
        }

        if (isset($configuration['rulesets'])) {
            $rulesets = $this->compileRuleSets($configuration['rulesets']);
        } else {
            $rulesets = [];
        }

        // Inherit values from general configuration in rule sets if needed
        foreach ($rulesets as $k => &$ruleset) {
            foreach ($general as $key => $value) {
                if (!isset($ruleset[$key])) {
                    $ruleset[$key] = $value;
                } elseif ($ruleset[$key] === '') {
                    $ruleset[$key] = $value;
                }
            }
            if (count($ruleset['usergroup']) == 0) {
                // Make sure not to try to override general configuration
                // => only keep directories not present in general configuration
                $ruleset['directories'] = array_diff($ruleset['directories'], $general['directories']);
                if (count($ruleset['directories']) == 0) {
                    unset($rulesets[$k]);
                }
            }
        }

        // Use general configuration as very last rule set
        $rulesets[] = $general;
        $this->rulesets = $rulesets;
    }