pickaname 0.1.2 → 0.1.7

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.
@@ -0,0 +1,198 @@
1
+ abstruse
2
+ esoteric
3
+ recondite
4
+ cloaked
5
+ concealed
6
+ disguised
7
+ masked
8
+ shrouded
9
+ beclouded
10
+ bedimmed
11
+ befogged
12
+ clouded
13
+ cloudy
14
+ dim
15
+ faint
16
+ foggy
17
+ fuzzy
18
+ hazy
19
+ indistinct
20
+ indistinguishable
21
+ misty
22
+ muddy
23
+ obfuscatory
24
+ obnubilated
25
+ obscurant
26
+ shaded
27
+ shadowlike
28
+ shadowy
29
+ sphinxlike
30
+ indefinite
31
+ inexact
32
+ inexplicit
33
+ noncommittal
34
+ questionable
35
+ unclear
36
+ uncertain
37
+ undefined
38
+ undetermined
39
+ vague
40
+ impenetrable
41
+ incomprehensible
42
+ indecipherable
43
+ inexplicable
44
+ eerie
45
+ uncanny
46
+ weird
47
+ impalpable
48
+ inappreciable
49
+ intangible
50
+ invisible
51
+ unanswerable
52
+ unknowable
53
+ baffling
54
+ bewildering
55
+ confounding
56
+ confusing
57
+ mystifying
58
+ perplexing
59
+ puzzling
60
+ unfathomable
61
+ circuitous
62
+ indirect
63
+ roundabout
64
+ complex
65
+ complicated
66
+ difficult
67
+ obtuse
68
+ comprehensible
69
+ fathomable
70
+ intelligible
71
+ knowable
72
+ legible
73
+ pellucid
74
+ understandable
75
+ bright
76
+ distinct
77
+ evident
78
+ self-evident
79
+ self-explanatory
80
+ certain
81
+ firm
82
+ strong
83
+ sure
84
+ defined
85
+ determined
86
+ direct
87
+ straightforward
88
+ definite
89
+ exact
90
+ explicit
91
+ appreciable
92
+ palpable
93
+ tangible
94
+ visible
95
+ blatant
96
+ patent
97
+ unmistakable
98
+ dark
99
+ darkling
100
+ fuzzy
101
+ murky
102
+ obscure
103
+ shadowy
104
+ vague
105
+ ambiguous
106
+ equivocal
107
+ imponderable
108
+ incomprehensible
109
+ unfathomable
110
+ unintelligible
111
+ unsearchable
112
+ inexplicable
113
+ unaccountable
114
+ unexplainable
115
+ unanswerable
116
+ unknowable
117
+ metaphysical
118
+ mystical
119
+ numinous
120
+ supernatural
121
+ abstruse
122
+ esoteric
123
+ recondite
124
+ baffling
125
+ befuddling
126
+ bewildering
127
+ confounding
128
+ confusing
129
+ disorienting
130
+ mystifying
131
+ perplexing
132
+ puzzling
133
+ crepuscular
134
+ twilit
135
+ moonless
136
+ starless
137
+ sunless
138
+ cloudy
139
+ dull
140
+ dulled
141
+ lackluster
142
+ shadowlike
143
+ shadowy
144
+ shady
145
+ gray
146
+ leaden
147
+ pale
148
+ beclouded
149
+ befogged
150
+ clouded
151
+ foggy
152
+ fuliginous
153
+ misty
154
+ smoggy
155
+ soupy
156
+ blue
157
+ dejected
158
+ depressed
159
+ despondent
160
+ down
161
+ droopy
162
+ hangdog
163
+ inconsolable
164
+ low
165
+ melancholic
166
+ melancholy
167
+ mirthless
168
+ sad
169
+ unhappy
170
+ woebegone
171
+ woeful
172
+ dim
173
+ discomfiting
174
+ discouraging
175
+ disheartening
176
+ dismaying
177
+ dispiriting
178
+ distressful
179
+ distressing
180
+ upsetting
181
+ desperate
182
+ hopeless
183
+ pessimistic
184
+ lamentable
185
+ mournful
186
+ plaintive
187
+ sorrowful
188
+ colorless
189
+ drab
190
+ dull
191
+ dour
192
+ grim
193
+ lowering
194
+ lowery
195
+ menacing
196
+ negative
197
+ oppressive
198
+ threatening
@@ -0,0 +1,30 @@
1
+ bum
2
+ catty
3
+ wobble
4
+ colly
5
+ phobia
6
+ bumber
7
+ shoot
8
+ gag
9
+ lolly
10
+ snolly
11
+ toon
12
+ bro
13
+ poopy
14
+ drama
15
+ quire
16
+ lick
17
+ crabby
18
+ smelly
19
+ ass
20
+ jack
21
+ blubber
22
+ doozy
23
+ gibberish
24
+ bitty
25
+ bitch
26
+ wishy
27
+ butt
28
+ cry
29
+ baby
30
+ juicy
@@ -1,41 +1,94 @@
1
1
  require "pickaname/version"
2
+ require 'timeout'
2
3
 
3
4
  module Pickaname
4
5
  class Error < StandardError; end
5
6
 
6
7
  class Robot
7
- PREFIX = File.foreach("lib/data/prefix.txt").map { |line| line.split(' ') }
8
- SUFFIX = File.foreach("lib/data/suffix.txt").map { |line| line.split(' ') }
8
+ PREFIX = File.foreach(File.join(File.dirname(__FILE__), 'data', 'prefix.txt')).map { |line| line.split(' ') }
9
+ SUFFIX = File.foreach(File.join(File.dirname(__FILE__), 'data', 'suffix.txt')).map { |line| line.split(' ') }
10
+ FUNNY = File.foreach(File.join(File.dirname(__FILE__), 'data', 'funny.txt')).map { |line| line.split(' ') }
11
+ COMMON = File.foreach(File.join(File.dirname(__FILE__), 'data', 'common.txt')).map { |line| line.split(' ') }
12
+ DARK = File.foreach(File.join(File.dirname(__FILE__), 'data', 'dark.txt')).map { |line| line.split(' ') }
13
+
9
14
  PREFIX_SIZE = 1
10
15
  SUFFIX_SIZE = 1
11
16
 
17
+ TIMEOUT_IN_SECONDS = 5
18
+
12
19
  attr_reader :name
13
20
 
14
21
  def initialize()
15
- @name = random_string
22
+ @name = random_str
23
+ end
24
+
25
+ # def self.pseudo
26
+ # @name = PREFIX.sample(PREFIX_SIZE).join << SUFFIX.sample(SUFFIX_SIZE).join
27
+ # end
28
+
29
+ def self.common(length: nil)
30
+ begin
31
+ Timeout::timeout(TIMEOUT_IN_SECONDS) do
32
+ @name = COMMON.sample(PREFIX_SIZE).join << COMMON.sample(SUFFIX_SIZE).join
33
+ while length
34
+ break if @name.length == length
35
+ @name = COMMON.sample(PREFIX_SIZE).join << COMMON.sample(SUFFIX_SIZE).join
36
+ end
37
+ return @name
38
+ end
39
+ rescue Timeout::Error
40
+ puts "Timeout: No results found"
41
+ end
16
42
  end
17
43
 
18
- def self.pseudo
19
- @name = PREFIX.sample(PREFIX_SIZE).join << SUFFIX.sample(SUFFIX_SIZE).join
44
+ def self.funny(length: nil)
45
+ begin
46
+ Timeout::timeout(TIMEOUT_IN_SECONDS) do
47
+ @name = COMMON.sample(PREFIX_SIZE).join << FUNNY.sample(SUFFIX_SIZE).join
48
+ while length
49
+ break if @name.length == length
50
+ @name = COMMON.sample(PREFIX_SIZE).join << FUNNY.sample(SUFFIX_SIZE).join
51
+ end
52
+ return @name
53
+ end
54
+ rescue Timeout::Error
55
+ puts "Timeout: No results found"
56
+ end
20
57
  end
21
58
 
22
- def self.random(record = Robot.new)
23
- @name = record.random_string
59
+ def self.dark(length: nil)
60
+ begin
61
+ Timeout::timeout(TIMEOUT_IN_SECONDS) do
62
+ @name = COMMON.sample(PREFIX_SIZE).join << DARK.sample(SUFFIX_SIZE).join
63
+ while length
64
+ break if @name.length == length
65
+ @name = COMMON.sample(PREFIX_SIZE).join << DARK.sample(SUFFIX_SIZE).join
66
+ end
67
+ return @name
68
+ end
69
+ rescue Timeout::Error
70
+ puts "Timeout: No results found"
71
+ end
24
72
  end
25
73
 
26
- def random_string
27
- down = ('a'..'z').to_a
28
- up = ('A'..'Z').to_a
29
- digits = ('0'..'9').to_a
30
- [extract1(down), extract1(up), extract1(digits)].
31
- concat(((down+up+digits).sample(8))).shuffle.join
74
+ def self.random_letters(length: 8)
75
+ record = Robot.new
76
+ begin
77
+ Timeout::timeout(TIMEOUT_IN_SECONDS) do
78
+ @name = record.random_str(length)
79
+ while length
80
+ break if @name.length == length
81
+ @name = record.random_str(length)
82
+ end
83
+ return @name
84
+ end
85
+ rescue Timeout::Error
86
+ puts "Timeout: No results found"
87
+ end
32
88
  end
33
89
 
34
- def extract1(arr)
35
- i = arr.size.times.to_a.sample
36
- c = arr[i]
37
- arr.delete_at(i)
38
- c
90
+ def random_str(length = 8)
91
+ return Array.new(length){[*"a".."z", *"0".."9"].sample}.join
39
92
  end
40
93
  end
41
94
  end
@@ -1,3 +1,3 @@
1
1
  module Pickaname
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pickaname
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Randomly generates a name
14
14
  email:
@@ -24,8 +24,12 @@ files:
24
24
  - LICENSE.txt
25
25
  - README.md
26
26
  - Rakefile
27
+ - _config.yml
27
28
  - bin/console
28
29
  - bin/setup
30
+ - lib/data/common.txt
31
+ - lib/data/dark.txt
32
+ - lib/data/funny.txt
29
33
  - lib/data/prefix.txt
30
34
  - lib/data/suffix.txt
31
35
  - lib/pickaname.rb