cfaker 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cfaker/address.rb +9 -0
- data/lib/cfaker/email.rb +14 -0
- data/lib/cfaker/mobile_phone.rb +19 -0
- data/lib/cfaker/name.rb +21 -0
- data/lib/cfaker/version.rb +1 -1
- metadata +7 -3
data/lib/cfaker/email.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Cfaker
|
2
|
+
module MobilePhone
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def mobile_phone(length=11)
|
6
|
+
"138" + phone_number(length)
|
7
|
+
end
|
8
|
+
|
9
|
+
def error_mobile_phone(length=11)
|
10
|
+
"245" + phone_number(length)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def phone_number(length)
|
16
|
+
Array.new(length - 3).map{D_BITS[rand(D_BITS_LENGTH)]}.join
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/cfaker/name.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Cfaker
|
2
|
+
module Name
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def name(length=8)
|
6
|
+
Array.new(length).map{ BITS[rand(BITS_LENGTH)]}.join
|
7
|
+
end
|
8
|
+
|
9
|
+
def chinese_name(length=5)
|
10
|
+
Array.new(length).map{ C_BITS[rand(C_BITS_LENGTH)]}.join
|
11
|
+
end
|
12
|
+
|
13
|
+
def digit_name(length=8)
|
14
|
+
Array.new(length).map{ D_BITS[rand(D_BITS_LENGTH)]}.join
|
15
|
+
end
|
16
|
+
|
17
|
+
def digit_start_name(length=8)
|
18
|
+
D_BITS[rand(D_BITS_LENGTH)].to_s + name(length - 1)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/cfaker/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cfaker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- dongsx
|
@@ -33,6 +33,10 @@ files:
|
|
33
33
|
- Rakefile
|
34
34
|
- cfaker.gemspec
|
35
35
|
- lib/cfaker.rb
|
36
|
+
- lib/cfaker/address.rb
|
37
|
+
- lib/cfaker/email.rb
|
38
|
+
- lib/cfaker/mobile_phone.rb
|
39
|
+
- lib/cfaker/name.rb
|
36
40
|
- lib/cfaker/version.rb
|
37
41
|
homepage: ""
|
38
42
|
licenses: []
|