I'm using Ruby 2.4. I know how to check if an eleemnt has never occurred more than twice in an array, using
data_arr.count(string) <= 2
["1/5", "2/6", "3/5", "4/7", "3/8", "3/9"]
You might begin by using hash::new with a default value of zero to construct a counting hash.
arr = ["1/5", "2/6", "3/5", "4/7", "3/8", "3/9"]
h = arr.each_with_object(Hash.new(0)) { |s,h| h[s[/\d+(?=\/)/]] += 1 }
#> {"1"=>1, "2"=>1, "3"=>3, "4"=>1}
Then write
h.any? { |_,v| v > 2 }
#=> true