randomperson 0.0.16 → 0.0.17
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.
- data.tar.gz.sig +0 -0
- data/lib/randomperson/Names/AmericanPrefix.rb +2 -3
- data/lib/randomperson/Names/BritishPrefix.rb +2 -3
- data/lib/randomperson/Names/EnglishPrefix.rb +2 -3
- data/lib/randomperson/Names/FinnishPrefix.rb +2 -3
- data/lib/randomperson/Names/ScottishPrefix.rb +2 -3
- data/lib/randomperson/Names/SpanishPrefix.rb +29 -0
- data/lib/randomperson/Names/WelshPrefix.rb +2 -3
- data/randomperson.gemspec +1 -1
- metadata +4 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
@@ -5,7 +5,7 @@ module RandomPerson
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
|
8
|
-
@formats_ratiod = [ 0..47, 48..
|
8
|
+
@formats_ratiod = [ 0..47, 48..49, 50..69, 70..87, 88..99]
|
9
9
|
|
10
10
|
@names = %w(Mr. Dr. Mrs. Ms. Miss )
|
11
11
|
end
|
@@ -17,8 +17,7 @@ module RandomPerson
|
|
17
17
|
return 'Mr.'
|
18
18
|
end
|
19
19
|
|
20
|
-
r = rand(
|
21
|
-
r += 49 if person.gender == 'f' #give 50% chance of being a Dr
|
20
|
+
r = rand(100) #0..99
|
22
21
|
|
23
22
|
i = @formats_ratiod.index_in_range( r )
|
24
23
|
return @names[i]
|
@@ -7,7 +7,7 @@ module RandomPerson
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
|
10
|
-
@formats_ratiod = [ 0..47, 48..
|
10
|
+
@formats_ratiod = [ 0..47, 48..49, 50..70, 71..87, 88..99]
|
11
11
|
|
12
12
|
@names = %w(Mr Dr Mrs Ms Miss)
|
13
13
|
end
|
@@ -19,8 +19,7 @@ module RandomPerson
|
|
19
19
|
return @names[0]
|
20
20
|
end
|
21
21
|
|
22
|
-
r = rand(
|
23
|
-
r += 49 if person.gender == 'f' #give 50% chance of being a Dr
|
22
|
+
r = rand(100) #0..99
|
24
23
|
|
25
24
|
i = @formats_ratiod.index_in_range( r )
|
26
25
|
return @names[i]
|
@@ -5,7 +5,7 @@ module RandomPerson
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
|
8
|
-
@formats_ratiod = [ 0..47, 48..
|
8
|
+
@formats_ratiod = [ 0..47, 48..49, 50..70, 71..87, 88..99]
|
9
9
|
|
10
10
|
@names = %w(Mr Dr Mrs Ms Miss )
|
11
11
|
end
|
@@ -17,8 +17,7 @@ module RandomPerson
|
|
17
17
|
return @names[0]
|
18
18
|
end
|
19
19
|
|
20
|
-
r = rand(
|
21
|
-
r += 49 if person.gender == 'f' #give 50% chance of being a Dr
|
20
|
+
r = rand(100) #0..99
|
22
21
|
|
23
22
|
i = @formats_ratiod.index_in_range( r )
|
24
23
|
return @names[i]
|
@@ -7,7 +7,7 @@ module RandomPerson
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
|
10
|
-
@formats_ratiod = [ 0..47, 48..
|
10
|
+
@formats_ratiod = [ 0..47, 48..49, 50..69, 70..99]
|
11
11
|
|
12
12
|
@names = %w(herra Dr rouva neiti)
|
13
13
|
end
|
@@ -19,8 +19,7 @@ module RandomPerson
|
|
19
19
|
return @names[0]
|
20
20
|
end
|
21
21
|
|
22
|
-
r = rand(
|
23
|
-
r += 49 if person.gender == 'f' #give 50% chance of being a Dr
|
22
|
+
r = rand(100) #0..99
|
24
23
|
|
25
24
|
i = @formats_ratiod.index_in_range( r )
|
26
25
|
return @names[i]
|
@@ -7,7 +7,7 @@ module RandomPerson
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
|
10
|
-
@formats_ratiod = [ 0..47, 48..
|
10
|
+
@formats_ratiod = [ 0..47, 48..49, 50..70, 71..87, 88..99]
|
11
11
|
|
12
12
|
@names = %w(Mr Dr Mrs Ms Miss)
|
13
13
|
end
|
@@ -19,8 +19,7 @@ module RandomPerson
|
|
19
19
|
return @names[0]
|
20
20
|
end
|
21
21
|
|
22
|
-
r = rand(
|
23
|
-
r += 49 if person.gender == 'f' #give 50% chance of being a Dr
|
22
|
+
r = rand(100) #0..99
|
24
23
|
|
25
24
|
i = @formats_ratiod.index_in_range( r )
|
26
25
|
return @names[i]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module RandomPerson
|
4
|
+
module Names
|
5
|
+
|
6
|
+
class SpanishPrefix < Name
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
|
10
|
+
@formats_ratiod = [ 0..47, 48, 49, 50..73, 74..99]
|
11
|
+
|
12
|
+
@names = %w(Sr. Dr. Dra. Sra. Srta.)
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute( person )
|
16
|
+
|
17
|
+
if person.age < 17
|
18
|
+
return @names[4] if person.gender == 'f'
|
19
|
+
return @names[0]
|
20
|
+
end
|
21
|
+
|
22
|
+
r = rand(100) #0..99
|
23
|
+
|
24
|
+
i = @formats_ratiod.index_in_range( r )
|
25
|
+
return @names[i]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -7,7 +7,7 @@ module RandomPerson
|
|
7
7
|
|
8
8
|
def initialize
|
9
9
|
|
10
|
-
@formats_ratiod = [ 0..47, 48..
|
10
|
+
@formats_ratiod = [ 0..47, 48..49, 50..70, 71..87, 88..99]
|
11
11
|
|
12
12
|
@names = %w(Mr Dr Mrs Ms Miss)
|
13
13
|
end
|
@@ -19,8 +19,7 @@ module RandomPerson
|
|
19
19
|
return @names[0]
|
20
20
|
end
|
21
21
|
|
22
|
-
r = rand(
|
23
|
-
r += 49 if person.gender == 'f' #give 50% chance of being a Dr
|
22
|
+
r = rand(100) #0..99
|
24
23
|
|
25
24
|
i = @formats_ratiod.index_in_range( r )
|
26
25
|
return @names[i]
|
data/randomperson.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.description = <<-EOF
|
10
10
|
RandomPerson is a port to Ruby of Perl's Data::RandomPerson. Use it to generate random persons given various parameters, such as country, age and gender ratio.
|
11
11
|
EOF
|
12
|
-
s.version = "0.0.
|
12
|
+
s.version = "0.0.17"
|
13
13
|
s.platform = Gem::Platform::RUBY
|
14
14
|
s.require_paths << 'ext'
|
15
15
|
s.required_ruby_version = ">= 1.9.1"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 17
|
9
|
+
version: 0.0.17
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Iain Barnett
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
YK13fiGcldY=
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2010-11-
|
38
|
+
date: 2010-11-13 00:00:00 +00:00
|
39
39
|
default_executable:
|
40
40
|
dependencies: []
|
41
41
|
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- lib/randomperson/Names/SpanishFemaleFirst.rb
|
95
95
|
- lib/randomperson/Names/SpanishLast.rb
|
96
96
|
- lib/randomperson/Names/SpanishMaleFirst.rb
|
97
|
+
- lib/randomperson/Names/SpanishPrefix.rb
|
97
98
|
- lib/randomperson/Names/SwedishFemaleFirst.rb
|
98
99
|
- lib/randomperson/Names/SwedishLast.rb
|
99
100
|
- lib/randomperson/Names/SwedishMaleFirst.rb
|
metadata.gz.sig
CHANGED
Binary file
|