Currently, String#count only accepts strings, and counts all the characters in the string.
However, I have repeatedly met the situation where I wanted to count more interesting things in strings.
These 'interesting things' can easily be expressed with regular expressions.
Here is a quick-and-dirty Ruby-level implementation:
str.count(sub[, start[, end]])
Return the number of non-overlapping occurrences of substringsub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.
I'd love to have this feature. A str.count(regexp) is something I see folk trying fairly often. A str.count(regexp) also avoids the intermediary Array of str.scan(regexp).size or the back bending with str.enum_for(:scan, regexp).count.
If str.count(re) works as str.scan(re).size (besides efficiency), it's acceptable. But if someone needs overlapping, they needs to explain their use-case.