Add support for dictionaries in sequences

This commit is contained in:
Adam Fowler
2021-03-11 17:13:43 +00:00
parent 9cbe74f9ee
commit 13f6d20976

View File

@@ -33,3 +33,20 @@ extension Array: HBSequence {
return ""
}
}
extension Dictionary: HBSequence {
func renderSection(with template: HBTemplate) -> String {
var string = ""
for obj in self {
string += template.render(obj)
}
return string
}
func renderInvertedSection(with template: HBTemplate) -> String {
if count == 0 {
return template.render(self)
}
return ""
}
}