PiecePipe is a library that allows you to write code by focusing on the flow of data through a pipeline of steps without worrying about the iteration and “glue code.” It also makes testing much easier by removing the need to test the “glue code.”
Back in June, Dave wrote a blog post about the PiecePipe gem, but he left out the usage of
Here is an example of using
HashedAggregator to do a simple group-by.
I’ve also added a GroupByStep to Piece Pipe that makes this example unnecessary.
If you are looking to sum values or use some sort of aggregate of the values, you should create a custom HashedAggregator step. Group by is a specialized case, but I found myself wanting it each time I used PiecePipe.