rails/cache_digests — pull request #19 by dasch (2012-12-09 16:30:15+00:00)
Title: Allow registering custom dependency trackers

This refactoring would allow various template handlers, including very non-Erb ones such as Mustache, to register custom dependency trackers.

I'd like to support this syntax for Mustache-like templates:

```ruby
class SomeMustache < Mustache
def self.dependencies
%w[ foo/bar baz/bum ]
end
end

class MustacheDependencyTracker
def self.call(name, template)
mustache_class = get_that_class_somehow
mustache_class.dependencies
end
end
```

(I'm not using Mustache, but something a bit like it).

I'm not sure exactly how much support there currently is for non-Erb template types. If some types are already supported, perhaps a base class can be extracted and each concrete tracker can subclass from it, so that there would be an ErbTracker, BuilderTracker, etc.

I'm not sure I got the `Template#handler` syntax right, though -- will the handler by a symbol, or the actual handler class? The Rails docs weren't very clear on that.