Interesting, I knew the C-like uses of sprintf (like %s), but I didn't know you could pass a hash like you mention. Thanks for sharing! It's definitely a good option if that fits your use case.
I've considered doing something like that with eval before, but that gets really scary really fast.
There are so many ways to do this type of thing in Ruby. I didn't know you could leave out "{}" in string interpolation for a long time:
# Example from your README
@name = 'Alice'
$age ='29'
puts "My name is #@name and I'm #$age years old"
It comes up pretty rarely for me, since it doesn't work with locals or anything other than just a single identifier. Of course, it's not too useful if you're reading the string from a file, etc.
Since there are so many ways to do simple templates in a line or two in Ruby, it makes me wonder how you can do this elegantly in JavaScript without an external library like Handlebars or Mustache.
var tmpl = 'My name is {{name}} and I'm {{age}} years old';
tmpl.something({ name: 'Alice', age: 29 }); // => "My name is Alice and I'm 29 years old"
Anyone have tricks up their sleeves?
Ben