William James
1/21/2007 1:56:00 AM
Trans wrote:
> Seesm like there should be a mehtod for this:
>
> h = { :a=>1, :b=>2, :c=>3 }
>
> h.what_method(:a, :c) #=> { :a=>1, :c=>3 }
> ^^^^^^^^^^^
>
> Or is there some other simple way we're supposed to do this?
>
> T.
h = { :a,1, :b,2, :c,3 }
==>{:c=>3, :a=>1, :b=>2}
h.reject{|k,v| ![:a,:c].include? k}
==>{:c=>3, :a=>1}