wordini 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/wordini.rb +18 -8
  2. metadata +1 -1
data/lib/wordini.rb CHANGED
@@ -1,21 +1,31 @@
1
1
  class Wordini
2
2
 
3
3
  def self.obfuscate(word_string, words_to_remove)
4
- word_string.split.map{ |word|
5
- if words_to_remove.include? word
6
- "*" * word.length
7
- else
8
- word
9
- end
10
- }.join(' ')
4
+ hide_words(word_string, words_to_remove)
11
5
  end
12
6
 
13
7
  def self.report(word_string, search_terms)
8
+ count_words(word_string, search_terms)
9
+ end
10
+
11
+ private
12
+
13
+ def self.count_words(word_string, search_terms)
14
14
  word_set = {}
15
- search_terms.each { |word|
15
+ search_terms.each { |word|
16
16
  count = word_string.split.count(word)
17
17
  word_set[word] = count
18
18
  }
19
19
  word_set
20
20
  end
21
+
22
+ def self.hide_words(word_string, words_to_remove)
23
+ word_string.split.map{ |word|
24
+ if words_to_remove.include? word
25
+ "*" * word.length
26
+ else
27
+ word
28
+ end
29
+ }.join(' ')
30
+ end
21
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wordini
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: