Hi --- -------- Original-Nachricht -------- > Datum: Mon, 5 May 2008 22:10:31 +0900 > Von: Damjan Rems <d_rems / yahoo.com> > An: ruby-talk / ruby-lang.org > Betreff: Hash question > > I would like to return only part of hash as hash object. > > Example: > h = { "a" => 100, "b" => 200, "c" => 300 } > result = h.somemethod('a','c') > # should result in { "a" => 100, "c" => 200} > > Is this already build in Hash object or should I start and code it. > > > by > TheR > -- > Posted via http://www.ruby-forum.com/. you can use Hash#select or Hash#delete or Hash#delete_if for tasks like this. See some examples in the documentation for Hash: http://www.ruby-doc.org/core/classes/Hash.html#M002898 Best regards, Axel -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal f Modem und ISDN: http://www.gmx.net/de/go/smartsurfer