Anyone?


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Maninder, Singh
Sent: Thursday, December 08, 2005 12:49 PM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] Prototype.js Hash Methods


Hi,

Has anyone seen any documentation on the Hash Object defined in the prototype 
library?

To be precise the following methods -

1. keys
2. values
3. toQueryString
4. inspect
5. Merge

I am trying to play around with them and have come up with the following 
examples -

var h    = $H({name: "john doe", email: "[EMAIL PROTECTED]", msg: "say hello to 
me"});
var h_in = h.inspect();
alert(h_in); 
//returns #<Hash:{'name': 'john doe', 'email': '[EMAIL PROTECTED]', 'msg': 'say 
hello to me'}>

var qs = h.toQueryString();
alert(qs);
//returns john%20doe&email=john%40doe.com&msg=say%20hello%20to%20me

var mer = h.merge(h);
alert(mer.name);
//returns john doe

alert(mer.email);
//returns [EMAIL PROTECTED]

alert(mer.msg);
//returns say hello to me

var a_keys = h.keys();
alert(a_keys);
//returns name, email, msg

var a_values = h.values();
alert(a_values);
//returns john doe,[EMAIL PROTECTED],say hello to me

I want to know if this is the correct usage and how the merge function really 
works.

Any help would be appreciated.

Thanks in advance,
Mandy.

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to