Instead of making hash substitution style templates, you could make them erb templates and then you could use full ruby in them.