Enchancement: ActiveSupport, add Hash#to_proc

class Hash def to_proc proc { |o| all? { |k, v| v === o[k] } } end end

``

This would allow to use Hash as a proc argument for methods in Enumerable module:

array = [{ key: “a” }, { key: “2aZ” }, { key: 12 }]

array.find(&{key: /Z/}) # => { key: “2aZ” } array.select(&{key: 1…20}) # => [{ key: 12}]

``

Ruby 2.3 has a method to_proc for a Hash and it work’s in a diffrent way. It looks like this:

my_hash = {
    }

[:e, :a, :b, :f, :c, :d].map(&my_hash)

# => [5, 1, 2, 6, 3, 4]