Skip to content

Commit 2dfd20a

Browse files
committed
Change conformance of Array for YAMLRepresentable
1 parent 8b82cf8 commit 2dfd20a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Sources/Build/YAML.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ extension Bool: YAMLRepresentable {
2626
}
2727
}
2828

29-
extension Array: YAMLRepresentable {
29+
extension Array where Element: YAMLRepresentable {
3030
var YAML: String {
31-
let stringArray = self.flatMap { $0 as? String }
32-
guard stringArray.count == self.count else { return "" }
33-
3431
func quote(input: String) -> String {
3532
for c in input.characters {
3633
if c == "@" || c == " " || c == "-" {
@@ -39,6 +36,7 @@ extension Array: YAMLRepresentable {
3936
}
4037
return input
4138
}
39+
let stringArray = self.flatMap { String($0) }
4240
return "[" + stringArray.map(quote).joinWithSeparator(", ") + "]"
4341
}
4442
}

0 commit comments

Comments
 (0)