Skip to content

Commit 7e74564

Browse files
committed
Expose AbsoluteConfigKey prepending/appending
1 parent 4a50528 commit 7e74564

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Sources/Configuration/ConfigKey.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,23 @@ extension AbsoluteConfigKey {
182182
/// Returns a new absolute configuration key by prepending the given relative key.
183183
/// - Parameter prefix: The relative configuration key to prepend to this key.
184184
/// - Returns: A new absolute configuration key with the prefix prepended.
185-
internal func prepending(_ prefix: ConfigKey) -> AbsoluteConfigKey {
185+
public func prepending(_ prefix: ConfigKey) -> AbsoluteConfigKey {
186186
var prefixedComponents = prefix.components
187187
prefixedComponents.append(contentsOf: self.components)
188188
var mergedContext = prefix.context
189189
mergedContext.merge(self.context) { $1 }
190190
return AbsoluteConfigKey(prefixedComponents, context: mergedContext)
191191
}
192+
193+
/// Returns a new absolute configuration key by appending the given relative key.
194+
/// - Parameter relative: The relative configuration key to append to this key.
195+
/// - Returns: A new absolute configuration key with the relative key appended.
196+
public func appending(_ relative: ConfigKey) -> AbsoluteConfigKey {
197+
var appended = self
198+
appended.components.append(contentsOf: relative.components)
199+
appended.context.merge(relative.context) { $1 }
200+
return appended
201+
}
192202
}
193203

194204
extension AbsoluteConfigKey: ExpressibleByArrayLiteral {

0 commit comments

Comments
 (0)