Issue #6118 has been reported by Yui NARUSE.

----------------------------------------
Feature #6118: Hash#keys_of(values), returns related keys of given values
https://bugs.ruby-lang.org/issues/6118

Author: Yui NARUSE
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 


Hash#key(value) ?????????????????????????

{a: 1, b: 2, c: 3, d: 1}.key(1)
=> :a
?????????????????????????????????
{a: 1, b: 2, c: 3, d: 1}.keys_of(1)
=> [:a, :d]
?????????????????????????????????

Ruby ?????????以???????????????????????????
????????????????????

class Hash
  def keys_of(*a)
    each_with_object([]) {|(k, v), r| r << k if a.include? v}
  end
end


-- 
http://bugs.ruby-lang.org/