prototype: Hash#toTemplateReplacements is an alias for Hash#toObject so you can once again pass hashes to Template#evaluate and String#interpolate.

This commit is contained in:
Sam Stephenson 2007-10-17 13:39:46 +00:00
parent d114e76e97
commit 8327ffd8ae
3 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,7 @@
*1.6.0_rc1* (October 16, 2007)
* Hash#toTemplateReplacements is an alias for Hash#toObject so you can once again pass hashes to Template#evaluate and String#interpolate. [sam]
* Fix Event#is(Left|Middle|Right)Click in IE. Closes #7520 (again). [Mislav Marohnić]
* Ensure Event.* generic methods work in IE, even when the event is not extended. [Viktor Kojouharov, Andrew Dupont]

View File

@ -116,4 +116,5 @@ var Hash = Class.create(Enumerable, (function() {
}
})());
Hash.from = $H;
Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
Hash.from = $H;

View File

@ -206,6 +206,13 @@
assertEnumEqual($w('_each keys map pluck unset'), h.keys().sort());
assertEqual('U', h.unset('unset'));
assertHashEqual({ _each: 'E', map: 'M', keys: 'K', pluck: 'P' }, h);
}},
testHashToTemplateReplacements: function() { with(this) {
var template = new Template("#{a} #{b}"), hash = $H({ a: "hello", b: "world" });
assertEqual("hello world", template.evaluate(hash.toObject()));
assertEqual("hello world", template.evaluate(hash));
assertEqual("hello", "#{a}".interpolate(hash));
}}
}, 'testlog');