diff options
Diffstat (limited to 'framework/Web/Javascripts/prototype/hash.js')
-rw-r--r-- | framework/Web/Javascripts/prototype/hash.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/framework/Web/Javascripts/prototype/hash.js b/framework/Web/Javascripts/prototype/hash.js deleted file mode 100644 index 1589189c..00000000 --- a/framework/Web/Javascripts/prototype/hash.js +++ /dev/null @@ -1,57 +0,0 @@ -var Hash = { - _each: function(iterator) { - for (var key in this) { - var value = this[key]; - if (typeof value == 'function') continue; - - var pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - }, - - keys: function() { - return this.pluck('key'); - }, - - values: function() { - return this.pluck('value'); - }, - - merge: function(hash) { - return $H(hash).inject($H(this), function(mergedHash, pair) { - mergedHash[pair.key] = pair.value; - return mergedHash; - }); - }, - - toQueryString: function() { - return this.map(function(pair) - { - //special case for PHP, array post data. - if(typeof(pair[1]) == 'object' || typeof(pair[1]) == 'array') - { - return $A(pair[1]).collect(function(value) - { - return encodeURIComponent(pair[0])+'='+encodeURIComponent(value);
- }).join('&');
- } - else - return pair.map(encodeURIComponent).join('='); - }).join('&'); - }, - - inspect: function() { - return '#<Hash:{' + this.map(function(pair) { - return pair.map(Object.inspect).join(': '); - }).join(', ') + '}>'; - } -} - -function $H(object) { - var hash = Object.extend({}, object || {}); - Object.extend(hash, Enumerable); - Object.extend(hash, Hash); - return hash; -} |