/*
--- 
https://gist.github.com/1092786

name: String.substitute

description: Replaces Core/String.substitute with an augmented version that supports More/Object.Extras's getFromPath.

requires: [Core/String, More/Object.Extras]

provides: [String.substitute]

...
*/

String.implement({

	substitute: function(object, regexp){
		return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
			if (match.charAt(0) == '\\') return match.slice(1);
			return Object.getFromPath(object, name) || '';
		});
	}

});
