I
Intransition
I want to suggest Hash#count be defined such that it counts hash
values. A it stands (using Enumerable#count) it only can ever return 0
or 1.
Current:
{:a=>1,:b=2,:c=>1}.count([:a,1]) #=> 1
{:x=>1,:b=2,:c=>1}.count([:a,1]) #=> 0
{:a=>1,:b=2,:c=>1}.count(1) #=> 0
Proposed:
{:a=>1,:b=2,:c=>1}.count(1) #=> 2
{:x=>1,:b=2,:c=>1}.count(1) #=> 2
It would be more useful that way. And, in the same vain, a #has_pair?
seems like an obvious addition.
values. A it stands (using Enumerable#count) it only can ever return 0
or 1.
Current:
{:a=>1,:b=2,:c=>1}.count([:a,1]) #=> 1
{:x=>1,:b=2,:c=>1}.count([:a,1]) #=> 0
{:a=>1,:b=2,:c=>1}.count(1) #=> 0
Proposed:
{:a=>1,:b=2,:c=>1}.count(1) #=> 2
{:x=>1,:b=2,:c=>1}.count(1) #=> 2
It would be more useful that way. And, in the same vain, a #has_pair?
seems like an obvious addition.