メモリ効率を気にしないでいいなら
str.scan(/hoge/).size

数を数えるためだけに配列が作られるのが嫌なら
count = 0
str.scan(/hoge) { count += 1 }
# ゼロで初期化するのが嫌ならenum_forとinjectで書き換え。