defunkt/mustache — pull request #136 by nuclearsandwich (2012-06-15 19:27:42+00:00)
Title: Enumerate any object tagged with Mustache::Enumerable.

This commit adds a module called `Mustache::Enumerable` which is a
method of signalling to the Mustache generator which enumerable objects
should be treated as arrays and which should be left alone.

To use it, create an object for Mustache to use as an array such as a
People class. Then include the Mustache::Enumerable module. As long as
your class is actually enumerable it will work as you expect.

Tagging with a custom module was preferred to checking for any
enumerable object since it can cause counter-intuitive behavior in
objects like Structs.

For an example of use see
`MustacheTest#test_enumerable_sections_enumerate_mustache_enumerables`
test/mustache_test.rb

This is a more heavyweight solution than the alternative I presented in
issue #93.