randomperson 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +31 -0
- data/README +220 -0
- data/Rakefile +23 -0
- data/lib/Choice.rb +82 -0
- data/lib/Generator.rb +97 -0
- data/lib/NameFiles/AmericanLast.rb +33 -0
- data/lib/NameFiles/AmericanMaleFirst.rb +31 -0
- data/lib/NameFiles/AmericanSuffix.rb +24 -0
- data/lib/NameFiles/AnyLast.rb +18 -0
- data/lib/NameFiles/BasqueLast.rb +40 -0
- data/lib/NameFiles/EnglishFemaleFirst.rb +18 -0
- data/lib/NameFiles/EnglishLast.rb +33 -0
- data/lib/NameFiles/EnglishPrefix.rb +26 -0
- data/lib/NameFiles/SpanishFemaleFirst.rb +38 -0
- data/lib/NameFiles/SpanishLast.rb +41 -0
- data/lib/NameFiles/SpanishMaleFirst.rb +39 -0
- data/lib/NameFiles/ThaiFirst.rb +39 -0
- data/lib/NameFiles/ThaiRomanisedFemaleFirst.rb +37 -0
- data/lib/NameFiles/ThaiRomanisedLast.rb +38 -0
- data/lib/NameFiles/ThaiRomanisedMaleFirst.rb +37 -0
- data/lib/Names.rb +14 -0
- data/lib/Person.rb +19 -0
- data/lib/Ratio.rb +53 -0
- data/lib/ext/Array.rb +16 -0
- data/lib/ext/Date.rb +10 -0
- data/lib/ext/Enumerable.rb +6 -0
- data/lib/ext/Hash.rb +9 -0
- data/lib/ext/Kernel.rb +23 -0
- data/lib/ext/Set.rb +11 -0
- data/lib/randomperson.rb +13 -0
- data/randomperson.gemspec +33 -0
- data/t/Generator.t +65 -0
- data.tar.gz.sig +5 -0
- metadata +151 -0
- metadata.gz.sig +3 -0
data/t/Generator.t
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby -wKU
|
2
|
+
|
3
|
+
require 'generator'
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class TestTask < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# def setup
|
9
|
+
#
|
10
|
+
# end
|
11
|
+
|
12
|
+
# def teardown
|
13
|
+
# end
|
14
|
+
|
15
|
+
# def test_load_names
|
16
|
+
# # assert_equal(@task1.from, 'iain')
|
17
|
+
# # assert_kind_of(@task1.added, Time)
|
18
|
+
# assert_equal
|
19
|
+
# end
|
20
|
+
|
21
|
+
def test_ratiod
|
22
|
+
assert_kind_of( RandomPerson::Generator.ratiod( [1,1] ), Array )
|
23
|
+
assert_kind_of( RandomPerson::Generator.ratiod([1,1]).first, Range )
|
24
|
+
assert_equal( RandomPerson::Generator.ratiod([1,3]).first.end, 25 )
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_pick_gender
|
28
|
+
assert_not_nil RandomPerson::Generator.pick_gender()
|
29
|
+
assert_equal( RandomPerson::Generator.pick_gender([1,0]), 'm' )
|
30
|
+
assert_equal( RandomPerson::Generator.pick_gender([0,1]), 'f' )
|
31
|
+
|
32
|
+
assert_equal( RandomPerson::Generator.pick_gender([10,0]), 'm' )
|
33
|
+
assert_equal( RandomPerson::Generator.pick_gender([0,10]), 'f' )
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_pick_age
|
37
|
+
n = 1000
|
38
|
+
while n > 0
|
39
|
+
r1 = rand(100)
|
40
|
+
r2 = rand(100) + r1
|
41
|
+
age = RandomPerson::Generator.pick_age(r1, r2)
|
42
|
+
assert_not_nil( age )
|
43
|
+
assert( r1..r2, age )
|
44
|
+
n = n - 1
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_pick_dob
|
49
|
+
n = 1000
|
50
|
+
while n > 0
|
51
|
+
r1 = rand(100)
|
52
|
+
dob = RandomPerson::Generator.pick_dob(r1)
|
53
|
+
# assert_kind_of(dob, Time)
|
54
|
+
# assert_not_nil( dob )
|
55
|
+
# assert_equal( dob.year, Time.now.year - r1 )
|
56
|
+
n = n - 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# def test_read_initialvalues_failure
|
61
|
+
# # assert_not_equal(@task1.from , "jane")
|
62
|
+
# # assert_not_nil(@task2.unique_id)
|
63
|
+
# end
|
64
|
+
|
65
|
+
end
|
data.tar.gz.sig
ADDED
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: randomperson
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Iain Barnett
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain:
|
16
|
+
- |
|
17
|
+
-----BEGIN CERTIFICATE-----
|
18
|
+
MIIDNDCCAhygAwIBAgIBADANBgkqhkiG9w0BAQUFADBAMRIwEAYDVQQDDAlpYWlu
|
19
|
+
c3BlZWQxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
20
|
+
bTAeFw0xMDA4MTkyMTQwMDlaFw0xMTA4MTkyMTQwMDlaMEAxEjAQBgNVBAMMCWlh
|
21
|
+
aW5zcGVlZDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
22
|
+
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApraebFPxvJVrayuZ
|
23
|
+
xJkFZLAId7j0G3QG4oyJcRaJVhaJ36zcCUeg6/6f9LC78nZSmL2zA2ZG9H3Lzda0
|
24
|
+
0j+McpynbK/eSq0XpruQbuuhcOBow1KgDfjdhz3qXylHJ/iIzBosQzoEIk5eVY84
|
25
|
+
R0qD+vNHwZQoDE+k4PB8LWIfbJPi+dmnL16C0qireO3nZASwTSGm1JdUtgESP0Hn
|
26
|
+
f1KAe/ox00S8cSQNGUZ/fAsrnhAOApL9V38TwxiL0eMVcY+TbUspI26MB8oNwsgV
|
27
|
+
zkBNt2lI45/SguV5wWMOWbWZ2v//w3PrBCUenkk+vwZmpOQUlk/8Ebrk+UeoAN1F
|
28
|
+
NqE2DQIDAQABozkwNzAJBgNVHRMEAjAAMB0GA1UdDgQWBBTMWVuCrozPKTpMRYkm
|
29
|
+
RUAqQFsGdDALBgNVHQ8EBAMCBLAwDQYJKoZIhvcNAQEFBQADggEBAFqZW23axU5A
|
30
|
+
Hf/p5iBfRlJLIZqFmVbGb1A+mxaPFUkhERH7FfY4ay4p2Ci1DNhSYQLy5dsB1ik0
|
31
|
+
J0tlNaXxkJ0uq6up65yoj4/XBJArm9oiO7PcwrzC52bmiEv4Ir67/AGRyfmgIU0A
|
32
|
+
5jv3cSFcnbrwCvClZOoVhNkvaxer3/DgLecpjgXfSwY++JHU0L/5HplidHzjE3PZ
|
33
|
+
1YGYQYJGIy5Hap8Lpn1x9/Q2C8pMX33JRItrIVie6UIsrGXVtGS5lZS/pri9Budd
|
34
|
+
+ikjZ+dLa/HjsXQ5HcI6WdySxyKElXr2Ecs8ipmnxCk6+KH9/2OnXrpBzeIXJoMS
|
35
|
+
YK13fiGcldY=
|
36
|
+
-----END CERTIFICATE-----
|
37
|
+
|
38
|
+
date: 2010-08-20 00:00:00 +01:00
|
39
|
+
default_executable:
|
40
|
+
dependencies: []
|
41
|
+
|
42
|
+
description: A gem for generating random persons
|
43
|
+
email: iainspeed @nospam@ gmail.com
|
44
|
+
executables: []
|
45
|
+
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
extra_rdoc_files:
|
49
|
+
- README
|
50
|
+
- lib/Choice.rb
|
51
|
+
- lib/Generator.rb
|
52
|
+
- lib/NameFiles/AmericanLast.rb
|
53
|
+
- lib/NameFiles/AmericanMaleFirst.rb
|
54
|
+
- lib/NameFiles/AmericanSuffix.rb
|
55
|
+
- lib/NameFiles/AnyLast.rb
|
56
|
+
- lib/NameFiles/BasqueLast.rb
|
57
|
+
- lib/NameFiles/EnglishFemaleFirst.rb
|
58
|
+
- lib/NameFiles/EnglishLast.rb
|
59
|
+
- lib/NameFiles/EnglishPrefix.rb
|
60
|
+
- lib/NameFiles/SpanishFemaleFirst.rb
|
61
|
+
- lib/NameFiles/SpanishLast.rb
|
62
|
+
- lib/NameFiles/SpanishMaleFirst.rb
|
63
|
+
- lib/NameFiles/ThaiFirst.rb
|
64
|
+
- lib/NameFiles/ThaiRomanisedFemaleFirst.rb
|
65
|
+
- lib/NameFiles/ThaiRomanisedLast.rb
|
66
|
+
- lib/NameFiles/ThaiRomanisedMaleFirst.rb
|
67
|
+
- lib/Names.rb
|
68
|
+
- lib/Person.rb
|
69
|
+
- lib/Ratio.rb
|
70
|
+
- lib/ext/Array.rb
|
71
|
+
- lib/ext/Date.rb
|
72
|
+
- lib/ext/Enumerable.rb
|
73
|
+
- lib/ext/Hash.rb
|
74
|
+
- lib/ext/Kernel.rb
|
75
|
+
- lib/ext/Set.rb
|
76
|
+
- lib/randomperson.rb
|
77
|
+
files:
|
78
|
+
- Manifest
|
79
|
+
- README
|
80
|
+
- Rakefile
|
81
|
+
- lib/Choice.rb
|
82
|
+
- lib/Generator.rb
|
83
|
+
- lib/NameFiles/AmericanLast.rb
|
84
|
+
- lib/NameFiles/AmericanMaleFirst.rb
|
85
|
+
- lib/NameFiles/AmericanSuffix.rb
|
86
|
+
- lib/NameFiles/AnyLast.rb
|
87
|
+
- lib/NameFiles/BasqueLast.rb
|
88
|
+
- lib/NameFiles/EnglishFemaleFirst.rb
|
89
|
+
- lib/NameFiles/EnglishLast.rb
|
90
|
+
- lib/NameFiles/EnglishPrefix.rb
|
91
|
+
- lib/NameFiles/SpanishFemaleFirst.rb
|
92
|
+
- lib/NameFiles/SpanishLast.rb
|
93
|
+
- lib/NameFiles/SpanishMaleFirst.rb
|
94
|
+
- lib/NameFiles/ThaiFirst.rb
|
95
|
+
- lib/NameFiles/ThaiRomanisedFemaleFirst.rb
|
96
|
+
- lib/NameFiles/ThaiRomanisedLast.rb
|
97
|
+
- lib/NameFiles/ThaiRomanisedMaleFirst.rb
|
98
|
+
- lib/Names.rb
|
99
|
+
- lib/Person.rb
|
100
|
+
- lib/Ratio.rb
|
101
|
+
- lib/ext/Array.rb
|
102
|
+
- lib/ext/Date.rb
|
103
|
+
- lib/ext/Enumerable.rb
|
104
|
+
- lib/ext/Hash.rb
|
105
|
+
- lib/ext/Kernel.rb
|
106
|
+
- lib/ext/Set.rb
|
107
|
+
- lib/randomperson.rb
|
108
|
+
- t/Generator.t
|
109
|
+
- randomperson.gemspec
|
110
|
+
has_rdoc: true
|
111
|
+
homepage: http://github.com/yb66/RandomPerson
|
112
|
+
licenses: []
|
113
|
+
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options:
|
116
|
+
- --line-numbers
|
117
|
+
- --inline-source
|
118
|
+
- --title
|
119
|
+
- Randomperson
|
120
|
+
- --main
|
121
|
+
- README
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
segments:
|
130
|
+
- 1
|
131
|
+
- 9
|
132
|
+
- 1
|
133
|
+
version: 1.9.1
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
segments:
|
140
|
+
- 1
|
141
|
+
- 2
|
142
|
+
version: "1.2"
|
143
|
+
requirements: []
|
144
|
+
|
145
|
+
rubyforge_project: randomperson
|
146
|
+
rubygems_version: 1.3.7
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: A gem for generating random persons
|
150
|
+
test_files: []
|
151
|
+
|
metadata.gz.sig
ADDED