class String
‘“foo: %{bar}” % { :bar => 10 } # => “foo: 10”`.
to replace named capture groups, i.e.
This monkeypatch extends Ruby 1.8 {String#%} with an ability
@api public
#
def %(arg, *args)
def %(arg, *args) if arg.is_a?(Hash) gsub(/%\{(\w+)\}/) do arg[$1.to_sym] end else original_percent(arg, *args) end end