Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.13 KB | None | 0 0
  1. @text = 'long text here'
  2. hash = key_words.each_with_object({}) do |key_word, hash|
  3.   hash[key_word] = @text.scan(key_word).count
  4. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement