Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @text = 'long text here'
- hash = key_words.each_with_object({}) do |key_word, hash|
- hash[key_word] = @text.scan(key_word).count
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement