skydb/sky.rb — pull request #15 by benbjohnson (2013-09-02 21:48:38+00:00)
Title: Add row normalization.

Adding some utility methods for converting Sky's nested hash result format into to a more traditional array of rows format. See the `test/unit/skydb_test.rb` for exact details but here's the quick rundown:

```
results = {"state" => {"CO" => {"count": 30}, {"CA" => "20"}}}
rows = SkyDB.denormalize(results, ["state"])
# =>
[{"state" => "CO", "count":30"}, {"state" => "CA", "count" => "20"}]
```

Then the normalize function will convert it back to the nested form. However, the normalize function can do partial normalization so your original results may have "state" and "gender" but you may want to keep the rows but just group by "gender" within each row. That's a more complicated example so check the test case for more details.