Ryan Leavengood wrote:
> On 1/4/06, phil swenson <phil.swenson / gmail.com> wrote:
>> 
>> Yeah, i can just iterate the keys... but it seems like there is a
>> "ruby" way to do this.  Any thoughts?
> 
> Another option:
> 
> h.map{|k,v| k if v=='1'}.compact
> 
> And of course an inject version:
> h.inject([]){|a,b| a<<b[0] if b[1]=='1';a}

You can even access key and value separately:

h.inject([]) {|a,(k,v)| a << k if v == '1'; a}

:-)

    robert