On Apr 12, 3:00 pm, ara howard <ara.t.how... / gmail.com> wrote:
> is this consistent with other peoples stdlib hacks?
>
> class Hash
>    def slice *keys, &block
>      if block
>        each do |key, val|
>          boolean = block.call(key, val)
>          keys << key if boolean
>        end
>      end
>      hash = self
>      keys.inject({}){|returned, key| returned.update key => hash[key]}
>    end
> end

http://raa.ruby-lang.org/project/hashslice/

Regards,

Dan