battery-staple 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 756f60cdbe9ebc3ff8552f4e74700c34a98346e7
4
- data.tar.gz: 65622b2d5677b49acc144155a6f48d368c675285
3
+ metadata.gz: 560801b8cd89cf0cb4a1f8866325e92391389220
4
+ data.tar.gz: fd30407a14c577895b0becdf0839d802072e7251
5
5
  SHA512:
6
- metadata.gz: 8411f7e9688ec68d917c8e499bf17dafa3274be3b5277444b4bbe78f71ef6a3133b87c27a5505a3d94b1374b27cf55f86425435b25a8fb62d852a640f0beb53a
7
- data.tar.gz: 09092159cf46941cb4226796d3d29b94a3a051792d8e67b5db5cb012dce1f9ade151bb96d2308760b1d08b6ff057b021da60eace33847e5831c33441359843be
6
+ metadata.gz: 6068eb81d6be852022c69e8cc66f3ea2054b9fe4b0bf370a54cd0a4b0791af40f48e2075d358266c1d7b7e15810607aea75ef5e24e90e3c2c5307c68152ed647
7
+ data.tar.gz: 523db2a5cdcda2ab543f3c46a4fa12cc1730d6b91cd0cff0749689950cd455e6e6ab96881ddb65374649cda71f996f62fc61c1e8ecd02a95c494f76441482b27
@@ -8,6 +8,7 @@ require 'random_password'
8
8
  require 'colorize'
9
9
 
10
10
  num_words = ARGV[0] ? ARGV[0].to_i : 4
11
+ clean = ARGV[1].to_s == '--clean'
11
12
 
12
13
  if num_words == 0
13
14
  puts "
@@ -15,6 +16,6 @@ if num_words == 0
15
16
  ".colorize(:red)
16
17
  else
17
18
  puts "
18
- Your new password is: \"#{RandomPassword.generate(num_words).colorize(:green)}\"
19
+ Your new password is: \"#{RandomPassword.generate(num_words, clean).colorize(:green)}\"
19
20
  "
20
21
  end
@@ -12241,7 +12241,7 @@ assizement
12241
12241
  assizer
12242
12242
  assizes
12243
12243
  asslike
12244
- assman
12244
+ assman:profane
12245
12245
  assmanship
12246
12246
  associability
12247
12247
  associable
@@ -19536,7 +19536,7 @@ bitangential
19536
19536
  bitanhol
19537
19537
  bitartrate
19538
19538
  bitbrace
19539
- bitch
19539
+ bitch:profane
19540
19540
  bite
19541
19541
  bitemporal
19542
19542
  bitentaculate
@@ -38787,7 +38787,7 @@ cranny
38787
38787
  cranreuch
38788
38788
  crantara
38789
38789
  crants
38790
- crap
38790
+ crap:profane
38791
38791
  crapaud
38792
38792
  crapaudine
38793
38793
  crape
@@ -41661,17 +41661,17 @@ dammar
41661
41661
  damme
41662
41662
  dammer
41663
41663
  dammish
41664
- damn
41665
- damnability
41666
- damnable
41667
- damnableness
41668
- damnably
41669
- damnation
41670
- damnatory
41671
- damned
41672
- damner
41673
- damnification
41674
- damnify
41664
+ damn:profane
41665
+ damnability:profane
41666
+ damnable:profane
41667
+ damnableness:profane
41668
+ damnably:profane
41669
+ damnation:profane
41670
+ damnatory:profane
41671
+ damned:profane
41672
+ damner:profane
41673
+ damnification:profane
41674
+ damnify:profane
41675
41675
  damning
41676
41676
  damningly
41677
41677
  damningness
@@ -1,12 +1,27 @@
1
1
  class DictionaryReader
2
- def self.read
3
- words = File.readlines("#{File.dirname(__FILE__)}/dictionary.txt").reject do |line|
4
- line.strip.size < 4 || uppercase?(line)
2
+ class << self
3
+
4
+ def read(clean = false)
5
+ lines = File.readlines("#{File.dirname(__FILE__)}/dictionary.txt").reject do |line|
6
+ word = get_word(line, clean)
7
+ word.size < 4 || uppercase?(word) || profane?(line, clean)
8
+ end
9
+ lines.map { |line| get_word(line, clean) }
10
+ end
11
+
12
+ private
13
+
14
+ def profane?(line, clean)
15
+ line.strip.end_with?(":profane") && clean
16
+ end
17
+
18
+ def uppercase?(word)
19
+ word[0].downcase != word[0]
20
+ end
21
+
22
+ def get_word(line, clean)
23
+ line.strip.gsub(/:profane/, '')
5
24
  end
6
- words.map { |word| word.strip }
7
- end
8
25
 
9
- def self.uppercase?(word)
10
- word[0].downcase != word[0]
11
26
  end
12
27
  end
@@ -14,8 +14,8 @@ class RandomPassword
14
14
  end.strip
15
15
  end
16
16
 
17
- def self.generate(num_words)
18
- dictionary = DictionaryReader.read
17
+ def self.generate(num_words, clean = false)
18
+ dictionary = DictionaryReader.read(clean)
19
19
  RandomPassword.new.generate(dictionary, num_words)
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: battery-staple
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Liddle