Trying to get my head around Enumerators on play 2.0.4 - I'd like to interleave one Enumerator with another, but only as long as length of the first enumerator (exclusive). So:
Enumerator("hello", "world") -> "hello" ", " "world"
Enumerator("one", "two", "three") -> "one" ", " "two" ", " "three"
The built-in interleave includes past the end of the 1st Enumerator, until the end of the 2nd Enumerator.
val commas : Enumerator[String] = {
Enumerator(", ", ", ", ", ")
}
val words : Enumerator[String] = {
Enumerator("hello", "world!")
}
Ok.stream(words interleave commas andThen Enumerator.eof)
produces "hello, world, , " not "hello, world"
Help much appreciated!