lib/wordini.rb in wordini-0.0.0 vs lib/wordini.rb in wordini-0.1.0
- old
+ new
@@ -1,14 +1,21 @@
class Wordini
def self.obfuscate(word_string, words_to_remove)
- split_words = word_string.split.map{ |word|
+ word_string.split.map{ |word|
if words_to_remove.include? word
word = "*" * word.split('').count
else
word = word
end
}.join(' ')
end
- #puts self.obfuscate("This is the most awesome way to run some awesome game", ["This", "awesome", "fun", "the"])
+ def self.report(word_string, search_terms)
+ word_set = {}
+ search_terms.each { |word|
+ count = word_string.split.count(word)
+ word_set[word] = count
+ }
+ word_set
+ end
end
\ No newline at end of file