Merge pull request #68 from yonaskolb/include_replace

Add replace syntax for Include
This commit is contained in:
Yonas Kolb
2017-09-25 17:33:20 +02:00
committed by GitHub
5 changed files with 40 additions and 4 deletions
+4 -1
View File
@@ -52,7 +52,10 @@ public struct SpecLoader {
var merged = base
for (key, value) in dictionary {
if let dictionary = value as? JSONDictionary, let base = merged[key] as? JSONDictionary {
if key.hasSuffix(":REPLACE") {
let newKey = key.replacingOccurrences(of: ":REPLACE", with: "")
merged[newKey] = value
} else if let dictionary = value as? JSONDictionary, let base = merged[key] as? JSONDictionary {
merged[key] = merge(dictionary: dictionary, onto: base)
} else if let array = value as? [Any], let base = merged[key] as? [Any] {
merged[key] = base + array