ffaker 2.12.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +7 -0
  3. data/REFERENCE.md +32 -2
  4. data/ffaker.gemspec +2 -2
  5. data/lib/ffaker.rb +4 -1
  6. data/lib/ffaker/address_us.rb +22 -2
  7. data/lib/ffaker/bank.rb +15 -3
  8. data/lib/ffaker/color_pl.rb +14 -0
  9. data/lib/ffaker/data/address_ja/city +0 -23
  10. data/lib/ffaker/data/address_us/state_abbr +0 -1
  11. data/lib/ffaker/data/bank/card_types +12 -0
  12. data/lib/ffaker/data/book/nouns +2 -2
  13. data/lib/ffaker/data/color_pl/names_list +122 -0
  14. data/lib/ffaker/data/movie/nouns +2 -2
  15. data/lib/ffaker/data/name/first_names_female +0 -230
  16. data/lib/ffaker/data/name/first_names_male +0 -37
  17. data/lib/ffaker/data/sport_pl/summer +53 -0
  18. data/lib/ffaker/data/sport_pl/winter +14 -0
  19. data/lib/ffaker/data/vehicle/color_prefixes +25 -0
  20. data/lib/ffaker/identification_kr.rb +1 -1
  21. data/lib/ffaker/identification_pl.rb +77 -0
  22. data/lib/ffaker/internet.rb +3 -5
  23. data/lib/ffaker/sport_pl.rb +25 -0
  24. data/lib/ffaker/utils/random_utils.rb +2 -0
  25. data/lib/ffaker/vehicle.rb +1 -6
  26. data/test/helper.rb +35 -0
  27. data/test/test_address_us.rb +9 -0
  28. data/test/test_bank.rb +41 -5
  29. data/test/test_color_pl.rb +13 -0
  30. data/test/test_identification_co.rb +1 -1
  31. data/test/test_identification_pl.rb +28 -0
  32. data/test/test_internet.rb +9 -9
  33. data/test/test_job_cn.rb +1 -1
  34. data/test/test_job_ja.rb +1 -1
  35. data/test/test_job_kr.rb +1 -1
  36. data/test/test_job_vn.rb +1 -1
  37. data/test/test_lorem_cn.rb +6 -6
  38. data/test/test_lorem_ja.rb +3 -3
  39. data/test/test_name_da.rb +3 -3
  40. data/test/test_phone_number_se.rb +2 -2
  41. data/test/test_sport_pl.rb +30 -0
  42. data/test/test_ssn_se.rb +4 -6
  43. data/test/test_time.rb +13 -6
  44. data/test/test_tweet.rb +6 -6
  45. metadata +18 -9
  46. data/lib/ffaker/data/address_jp/city +0 -127
  47. data/lib/ffaker/data/address_jp/designated_city +0 -20
  48. data/lib/ffaker/data/address_jp/street +0 -37
  49. data/lib/ffaker/data/address_jp/tokyo_ward +0 -23
  50. data/lib/ffaker/data/address_jp/village +0 -183
  51. data/lib/ffaker/data/address_jp/ward +0 -188
@@ -23,7 +23,6 @@ Alec
23
23
  Alejandro
24
24
  Alex
25
25
  Alexander
26
- Alexis
27
26
  Alfonso
28
27
  Alfonzo
29
28
  Alfred
@@ -36,7 +35,6 @@ Alonzo
36
35
  Alphonse
37
36
  Alphonso
38
37
  Alton
39
- Alva
40
38
  Alvaro
41
39
  Alvin
42
40
  Amado
@@ -57,7 +55,6 @@ Antione
57
55
  Antoine
58
56
  Anton
59
57
  Antone
60
- Antonia
61
58
  Antonio
62
59
  Antony
63
60
  Antwan
@@ -78,7 +75,6 @@ Arthur
78
75
  Arturo
79
76
  Asa
80
77
  Ashley
81
- Aubrey
82
78
  August
83
79
  Augustine
84
80
  Augustus
@@ -103,7 +99,6 @@ Benton
103
99
  Bernard
104
100
  Bernardo
105
101
  Bernie
106
- Berry
107
102
  Bert
108
103
  Bertram
109
104
  Bill
@@ -198,7 +193,6 @@ Christoper
198
193
  Christopher
199
194
  Chuck
200
195
  Chung
201
- Clair
202
196
  Clarence
203
197
  Clark
204
198
  Claud
@@ -225,7 +219,6 @@ Colin
225
219
  Collin
226
220
  Colton
227
221
  Columbus
228
- Connie
229
222
  Conrad
230
223
  Cordell
231
224
  Corey
@@ -233,7 +226,6 @@ Cornelius
233
226
  Cornell
234
227
  Cortez
235
228
  Cory
236
- Courtney
237
229
  Coy
238
230
  Craig
239
231
  Cristobal
@@ -396,7 +388,6 @@ Eric
396
388
  Erich
397
389
  Erick
398
390
  Erik
399
- Erin
400
391
  Ernest
401
392
  Ernesto
402
393
  Ernie
@@ -451,7 +442,6 @@ Fredrick
451
442
  Freeman
452
443
  Fritz
453
444
  Gabriel
454
- Gail
455
445
  Gale
456
446
  Galen
457
447
  Garfield
@@ -620,14 +610,10 @@ Jess
620
610
  Jesse
621
611
  Jessie
622
612
  Jesus
623
- Jewel
624
- Jewell
625
613
  Jim
626
614
  Jimmie
627
615
  Jimmy
628
- Joan
629
616
  Joaquin
630
- Jody
631
617
  Joe
632
618
  Joel
633
619
  Joesph
@@ -700,7 +686,6 @@ Kristopher
700
686
  Kurt
701
687
  Kurtis
702
688
  Kyle
703
- Lacy
704
689
  Lamar
705
690
  Lamont
706
691
  Lance
@@ -708,17 +693,13 @@ Landon
708
693
  Lane
709
694
  Lanny
710
695
  Larry
711
- Lauren
712
696
  Laurence
713
- Lavern
714
- Laverne
715
697
  Lawerence
716
698
  Lawrence
717
699
  Lazaro
718
700
  Leandro
719
701
  Lee
720
702
  Leif
721
- Leigh
722
703
  Leland
723
704
  Lemuel
724
705
  Len
@@ -738,8 +719,6 @@ Lester
738
719
  Levi
739
720
  Lewis
740
721
  Lincoln
741
- Lindsay
742
- Lindsey
743
722
  Lino
744
723
  Linwood
745
724
  Lionel
@@ -749,7 +728,6 @@ Lon
749
728
  Long
750
729
  Lonnie
751
730
  Lonny
752
- Loren
753
731
  Lorenzo
754
732
  Lou
755
733
  Louie
@@ -789,7 +767,6 @@ Marco
789
767
  Marcos
790
768
  Marcus
791
769
  Margarito
792
- Maria
793
770
  Mariano
794
771
  Mario
795
772
  Marion
@@ -802,7 +779,6 @@ Marshall
802
779
  Martin
803
780
  Marty
804
781
  Marvin
805
- Mary
806
782
  Mason
807
783
  Mathew
808
784
  Matt
@@ -837,7 +813,6 @@ Milford
837
813
  Millard
838
814
  Milo
839
815
  Milton
840
- Minh
841
816
  Miquel
842
817
  Mitch
843
818
  Mitchel
@@ -874,7 +849,6 @@ Newton
874
849
  Nicholas
875
850
  Nick
876
851
  Nickolas
877
- Nicky
878
852
  Nicolas
879
853
  Nigel
880
854
  Noah
@@ -887,7 +861,6 @@ Norberto
887
861
  Norman
888
862
  Normand
889
863
  Norris
890
- Numbers
891
864
  Octavio
892
865
  Odell
893
866
  Odis
@@ -910,11 +883,9 @@ Otto
910
883
  Owen
911
884
  Pablo
912
885
  Palmer
913
- Paris
914
886
  Parker
915
887
  Pasquale
916
888
  Pat
917
- Patricia
918
889
  Patrick
919
890
  Paul
920
891
  Pedro
@@ -1037,7 +1008,6 @@ Sammie
1037
1008
  Sammy
1038
1009
  Samual
1039
1010
  Samuel
1040
- Sandy
1041
1011
  Sanford
1042
1012
  Sang
1043
1013
  Santiago
@@ -1059,12 +1029,10 @@ Shannon
1059
1029
  Shaun
1060
1030
  Shawn
1061
1031
  Shayne
1062
- Shelby
1063
1032
  Sheldon
1064
1033
  Shelton
1065
1034
  Sherman
1066
1035
  Sherwood
1067
- Shirley
1068
1036
  Shon
1069
1037
  Sid
1070
1038
  Sidney
@@ -1075,8 +1043,6 @@ Solomon
1075
1043
  Son
1076
1044
  Sonny
1077
1045
  Spencer
1078
- Stacey
1079
- Stacy
1080
1046
  Stan
1081
1047
  Stanford
1082
1048
  Stanley
@@ -1126,7 +1092,6 @@ Tommie
1126
1092
  Tommy
1127
1093
  Toney
1128
1094
  Tony
1129
- Tory
1130
1095
  Tracey
1131
1096
  Tracy
1132
1097
  Travis
@@ -1134,7 +1099,6 @@ Trent
1134
1099
  Trenton
1135
1100
  Trevor
1136
1101
  Trey
1137
- Trinidad
1138
1102
  Tristan
1139
1103
  Troy
1140
1104
  Truman
@@ -1149,7 +1113,6 @@ Tyson
1149
1113
  Ulysses
1150
1114
  Val
1151
1115
  Valentin
1152
- Valentine
1153
1116
  Van
1154
1117
  Vance
1155
1118
  Vaughn
@@ -0,0 +1,53 @@
1
+ Badminton
2
+ Baseball
3
+ Biegi płotkarski
4
+ Bule
5
+ Dżudo
6
+ Futbol amerykański
7
+ Gimnastyka artystyczna
8
+ Gimnastyka sportowa
9
+ Golf
10
+ Hokej na trawie
11
+ Jeździectwo
12
+ Kajakarstwo górskie
13
+ Kajakarstwo regatowe
14
+ Kolarstwo szosowe
15
+ Kolarstwo torowe
16
+ Koszykówka
17
+ Krykiet
18
+ Lacrosse
19
+ Łucznictwo
20
+ Pchnięcie kulą
21
+ Pięciobój nowoczesny
22
+ Pięściarstwo
23
+ Piłka nożna
24
+ Piłka ręczna
25
+ Piłka wodna
26
+ Pływanie synchroniczne
27
+ Podnoszenie ciężarów
28
+ Poker
29
+ Polo
30
+ Rugby
31
+ Rzut dyskiem
32
+ Rzut młotem
33
+ Rzut oszczepem
34
+ Siatkówka
35
+ Siatkówka plażowa
36
+ Skok o tyczce
37
+ Skok w dal
38
+ Skok wzwyż
39
+ Skoki do wody
40
+ Squash
41
+ Strzelectwo
42
+ Szachy
43
+ Szermierka
44
+ Taekwondo
45
+ Tenis stołowy
46
+ Tenis ziemny
47
+ Trójbój
48
+ Trójskok
49
+ Unihokej
50
+ Wędkarstwo
51
+ Wioślarstwo
52
+ Zapasy
53
+ Żeglarstwo
@@ -0,0 +1,14 @@
1
+ Biegi narciarskie
2
+ Bobsleje
3
+ Curling
4
+ Dwubój zimowy
5
+ Hokej na lodzie
6
+ Kombinacja norweska
7
+ Łyżwiarstwo figurowe
8
+ Łyżwiarstwo szybkie
9
+ Narciarstwo alpejskie
10
+ Narciarstwo dowolne
11
+ Saneczkarstwo
12
+ Skeleton
13
+ Skoki narciarskie
14
+ Snowboarding
@@ -0,0 +1,25 @@
1
+ beautiful
2
+ bright
3
+ calm
4
+ dangerous
5
+ dark
6
+ dull
7
+ fast
8
+ magnetic
9
+ magnificent
10
+ majestic
11
+ melodic
12
+ metallic
13
+ mundane
14
+ mute
15
+ mysterious
16
+ new
17
+ pleasant
18
+ pretty
19
+ resonant
20
+ royal
21
+ slate
22
+ soft
23
+ tranquil
24
+ vibrant
25
+ weak
@@ -8,7 +8,7 @@ module FFaker
8
8
  # Resident Registration Number
9
9
  # http://ko.wikipedia.org/wiki/%EC%A3%BC%EB%AF%BC%EB%93%B1%EB%A1%9D%EB%B2%88%ED%98%B8
10
10
  def rrn
11
- birth = fetch_sample([*Date.new(1970, 1, 1)..Date.new(1999, 12, 31)]).strftime('%y%d%m')
11
+ birth = fetch_sample(Date.new(1970, 1, 1)..Date.new(1999, 12, 31)).strftime('%y%d%m')
12
12
  sex = fetch_sample([1, 2])
13
13
  loc = FFaker.numerify("#{fetch_sample([*'00'..'95'])}###")
14
14
  a, b, c, d, e, f, g, h, i, j, k, l = "#{birth}#{sex}#{loc}".split(//).map(&:to_i)
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+
5
+ module FFaker
6
+ module IdentificationPL
7
+ extend ModuleUtils
8
+ extend self
9
+
10
+ # Polish national identification number
11
+ # https://en.wikipedia.org/wiki/PESEL
12
+ def pesel
13
+ date = generate_valid_pesel_date
14
+ birthdate = pesel_birthdate(date)
15
+ serial_number = FFaker.numerify('####')
16
+ checksum = pesel_checksum(birthdate, serial_number)
17
+ "#{birthdate}#{serial_number}#{checksum}"
18
+ end
19
+
20
+ # Polish identity card number
21
+ # https://en.wikipedia.org/wiki/Polish_identity_card
22
+ def identity_card
23
+ letter_part = FFaker.letterify('???').upcase
24
+ number_part = FFaker.numerify('#####')
25
+ checksum = identity_card_checksum(letter_part, number_part)
26
+ "#{letter_part}#{checksum}#{number_part}"
27
+ end
28
+
29
+ alias id identity_card
30
+
31
+ # Polish driver's licence number
32
+ # https://en.wikipedia.org/wiki/Driving_licence_in_Poland
33
+ def drivers_license
34
+ FFaker.numerify('#####/##/####')
35
+ end
36
+
37
+ private
38
+
39
+ def generate_valid_pesel_date
40
+ from = Date.new(1800, 1, 1)
41
+ to = [Date.today, Date.new(2299, 12, 31)].min
42
+ fetch_sample(from..to)
43
+ end
44
+
45
+ def pesel_birthdate(date)
46
+ century_differentiator = pesel_century_differentiator(date.year)
47
+
48
+ year = date.strftime('%y')
49
+ month = century_differentiator.zero? ? date.strftime('%m') : date.month + century_differentiator
50
+ day = date.strftime('%d')
51
+
52
+ "#{year}#{month}#{day}"
53
+ end
54
+
55
+ def pesel_century_differentiator(year)
56
+ case year
57
+ when 1800..1899 then 80
58
+ when 2000..2099 then 20
59
+ when 2100..2199 then 40
60
+ when 2200..2299 then 60
61
+ else 0
62
+ end
63
+ end
64
+
65
+ def pesel_checksum(date, serial_number)
66
+ pesel_digits = "#{date}#{serial_number}".split('').map(&:to_i)
67
+ a, b, c, d, e, f, g, h, i, j = pesel_digits
68
+ (a * 9 + b * 7 + c * 3 + d + e * 9 + f * 7 + g * 3 + h + i * 9 + j * 7) % 10
69
+ end
70
+
71
+ def identity_card_checksum(letter_part, number_part)
72
+ a, b, c = letter_part.codepoints.map { |codepoints| codepoints - 55 }
73
+ d, e, f, g, h = number_part.split('').map(&:to_i)
74
+ (a * 7 + b * 3 + c + 7 * d + 3 * e + f + 7 * g + 3 * h) % 10
75
+ end
76
+ end
77
+ end
@@ -39,7 +39,7 @@ module FFaker
39
39
 
40
40
  return sanitize(Name.first_name) if rand(0..1).zero?
41
41
 
42
- [Name.first_name, Name.last_name].join(fetch_sample(%w[. _])).downcase
42
+ [sanitize(Name.first_name), sanitize(Name.last_name)].join(fetch_sample(%w[. _]))
43
43
  end
44
44
 
45
45
  def domain_name
@@ -47,9 +47,7 @@ module FFaker
47
47
  end
48
48
 
49
49
  def domain_word
50
- dw = Company.name.split(' ').first
51
- dw.gsub!(/\W/, '')
52
- dw.downcase
50
+ sanitize(Company.name.split(' ').first)
53
51
  end
54
52
 
55
53
  def domain_suffix
@@ -75,7 +73,7 @@ module FFaker
75
73
  end
76
74
 
77
75
  def password(min_length = 8, max_length = 16)
78
- length = min_length > max_length ? min_length : fetch_sample([*min_length..max_length])
76
+ length = min_length > max_length ? min_length : fetch_sample(min_length..max_length)
79
77
  String.from_regexp(/\w{#{length}}/)
80
78
  end
81
79
 
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FFaker
4
+ # Inspirations:
5
+ # https://pl.wikipedia.org/wiki/Kategoria:Dyscypliny_sportowe
6
+ # https://pl.wikipedia.org/wiki/Igrzyska_olimpijskie
7
+ module SportPL
8
+ extend ModuleUtils
9
+ extend self
10
+
11
+ ALL = SUMMER + WINTER
12
+
13
+ def name
14
+ fetch_sample(ALL)
15
+ end
16
+
17
+ def summer
18
+ fetch_sample(SUMMER)
19
+ end
20
+
21
+ def winter
22
+ fetch_sample(WINTER)
23
+ end
24
+ end
25
+ end