Refactor ruby:word-count