cuculungwa 0.0.81 → 0.0.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cuculungwa/generators.rb +14 -10
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50562c7e720b0791fd72e81e3c6fc75c30124e75
|
4
|
+
data.tar.gz: a30ea8aade913a0c1bc46537b89649545289266c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb3428e675052f79af27acc3baa4b00bd55f39df3e72a69b332c2cad84b464cd75579d7d88703af1e25b938bf816d5aa566b2e3f31ce02292988f452f377af7e
|
7
|
+
data.tar.gz: a2ed85df2b2470c32790fe16c3ef44f7cf8aaef35695e37ed208addb528846780c0bcbb14f6cd18713a86004590381c8a12bce61855e6f6867556910fc84b978
|
@@ -1,14 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module Generators
|
2
2
|
def get_unique_email(prefix = 'email', domain = 'test.com')
|
3
3
|
# returns unique test email
|
4
4
|
"#{prefix}-#{(Time.now.to_f * 1_000_000).to_i}@#{domain}"
|
5
5
|
end
|
6
6
|
|
7
|
-
def get_test_password
|
8
|
-
# returns standard test password
|
9
|
-
'q1w2e3r4'
|
10
|
-
end
|
11
|
-
|
12
7
|
def get_random_currency_symbol
|
13
8
|
currencies = %w(
|
14
9
|
PLN EUR USD GBP CZK)
|
@@ -17,11 +12,20 @@ module GenerateData
|
|
17
12
|
|
18
13
|
# generators below perform typical polish data
|
19
14
|
|
20
|
-
def pesel_generator(data_type)
|
15
|
+
def pesel_generator(data_type, adult = true)
|
21
16
|
# returns polish registration number of the population
|
22
17
|
if data_type.eql? 'positive_data_set'
|
23
18
|
weights = Array[1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
|
24
|
-
|
19
|
+
current_year = Time.new.year
|
20
|
+
temp_up = (current_year - 18).to_s[-2..-1].to_i
|
21
|
+
temp_down = (current_year - 99).to_s[-2..-1].to_i
|
22
|
+
if adult == true
|
23
|
+
year = (rand * 100).to_i
|
24
|
+
year = (rand * 100).to_i until (temp_down < year) && (year < temp_up)
|
25
|
+
else
|
26
|
+
year = (rand * 100).to_i
|
27
|
+
year = (rand * 100).to_i until (temp_down > year) || (year > temp_up)
|
28
|
+
end
|
25
29
|
month = rand * 12 + 1
|
26
30
|
day = rand * 28 + 1
|
27
31
|
evidence_number = rand * 999
|
@@ -69,7 +73,7 @@ module GenerateData
|
|
69
73
|
bank_prefix ||= sprintf('%08d', rand(10**8))
|
70
74
|
bank_prefix = bank_prefix.to_s.gsub(/\s+/, '')
|
71
75
|
|
72
|
-
|
76
|
+
raise 'Bank prefix error!' if bank_prefix.length < 4
|
73
77
|
|
74
78
|
bank_prefix << '0001' if bank_prefix.length == 4
|
75
79
|
|
@@ -89,4 +93,4 @@ module GenerateData
|
|
89
93
|
end
|
90
94
|
end
|
91
95
|
end
|
92
|
-
World(
|
96
|
+
World(Generators)
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuculungwa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Kaftanski
|
8
8
|
- Jakub Kubiak
|
9
9
|
- Tomasz Tokarski
|
10
10
|
- Jaroslaw Biniek
|
11
|
+
- Maciej Krol
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|