gid 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/gid.rb +23 -12
- metadata +2 -2
data/gid.rb
CHANGED
@@ -1,15 +1,26 @@
|
|
1
1
|
class GID
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
str << "#{rand(10)}"
|
9
|
-
else
|
10
|
-
str << letters.sample
|
11
|
-
end
|
12
|
-
end
|
13
|
-
return str
|
2
|
+
# Filters out naughty words
|
3
|
+
def self.filter! str
|
4
|
+
words = ["fuck", "shit", "bitch", "cunt", "fag", "douche", "ass", "a55", "b1tch", "f4g", "5h1t"]
|
5
|
+
substitutes = ["faxf", "spwo", "bawpr", "capf", "fpa", "dclax", "aic", "a21", "b5sea", "f8m", "1z8l"]
|
6
|
+
words.each do |x|
|
7
|
+
str.gsub!(x, substitutes[words.index(x)])
|
14
8
|
end
|
9
|
+
return str
|
10
|
+
end
|
11
|
+
# Generates a new GID
|
12
|
+
def self.generate length
|
13
|
+
str = ""
|
14
|
+
letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
|
15
|
+
types = [Fixnum, String, String]
|
16
|
+
length.times do
|
17
|
+
if types.sample == Fixnum
|
18
|
+
str << "#{rand(10)}"
|
19
|
+
else
|
20
|
+
str << letters.sample
|
21
|
+
end
|
22
|
+
end
|
23
|
+
filter! str
|
24
|
+
return str
|
25
|
+
end
|
15
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ cert_chain: []
|
|
12
12
|
date: 2012-06-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Generates random mixes of numbers and letters of fixed length, usable
|
15
|
-
as UUIDs.
|
15
|
+
as UUIDs. Now filters out 'naughty' words
|
16
16
|
email: slmnwise@gmail.com
|
17
17
|
executables: []
|
18
18
|
extensions: []
|