class Wordini def self.obfuscate(word_string, words_to_remove) hide_words(word_string, words_to_remove) end def self.report(word_string, search_terms) count_words(word_string, search_terms) end private def self.count_words(word_string, search_terms) word_set = {} search_terms.each { |word| count = word_string.split.count(word) word_set[word] = count } word_set end def self.hide_words(word_string, words_to_remove) word_string.split.map{ |word| if words_to_remove.include? word "*" * word.length else word end }.join(' ') end end