gid 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/gid.rb +12 -4
- metadata +5 -5
data/gid.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class GID
|
2
2
|
# Filters out naughty words
|
3
|
-
def
|
3
|
+
def filter! str
|
4
4
|
words = ["fuck", "shit", "bitch", "cunt", "fag", "douche", "ass", "a55", "b1tch", "f4g", "5h1t"]
|
5
5
|
substitutes = ["faxf", "spwo", "bawpr", "capf", "fpa", "dclax", "aic", "a21", "b5sea", "f8m", "1z8l"]
|
6
6
|
words.each do |x|
|
@@ -9,15 +9,23 @@ class GID
|
|
9
9
|
return str
|
10
10
|
end
|
11
11
|
# Generates a new GID
|
12
|
-
def
|
12
|
+
def generate length=32, lean=String
|
13
13
|
str = ""
|
14
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
15
|
types = [Fixnum, String]
|
16
|
-
|
16
|
+
unless lean.is_a? Array
|
17
|
+
types.push(lean)
|
18
|
+
else
|
19
|
+
lean.map do |type|
|
20
|
+
unless type == String or type == Fixnum
|
21
|
+
types.push(lean)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
17
25
|
length.times do
|
18
26
|
if types.sample == Fixnum
|
19
27
|
str << "#{rand(10)}"
|
20
|
-
|
28
|
+
elsif types.sample == String
|
21
29
|
str << letters.sample
|
22
30
|
end
|
23
31
|
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: 4.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: Generates random mixes of numbers and letters of fixed length, usable
|
15
|
-
as UUIDs. Now
|
16
|
-
|
14
|
+
description: ! 'Generates random mixes of numbers and letters of fixed length, usable
|
15
|
+
as UUIDs. Now supports Arrays as an argument type for lean. Also has a instance-based
|
16
|
+
interfaced, you now have to do: gid = GID.new; gid.generate'
|
17
17
|
email: slmnwise@gmail.com
|
18
18
|
executables: []
|
19
19
|
extensions: []
|