ffaker 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +8 -0
  3. data/REFERENCE.md +10 -0
  4. data/ffaker.gemspec +1 -1
  5. data/lib/ffaker/address_au.rb +2 -1
  6. data/lib/ffaker/address_br.rb +5 -1
  7. data/lib/ffaker/address_gr.rb +2 -2
  8. data/lib/ffaker/address_ja.rb +12 -12
  9. data/lib/ffaker/address_mx.rb +364 -364
  10. data/lib/ffaker/address_pl.rb +85 -0
  11. data/lib/ffaker/animals.rb +12 -0
  12. data/lib/ffaker/data/address_pl/city +916 -0
  13. data/lib/ffaker/data/address_pl/square +390 -0
  14. data/lib/ffaker/data/address_pl/street +390 -0
  15. data/lib/ffaker/data/address_pl/voivodeship +16 -0
  16. data/lib/ffaker/data/address_pl/voivodeship_abbr +16 -0
  17. data/lib/ffaker/data/address_pl/voivodeship_capital_city +18 -0
  18. data/lib/ffaker/data/animal/common_names +141 -0
  19. data/lib/ffaker/data/filesystem/extension +32 -0
  20. data/lib/ffaker/data/filesystem/mime_type +67 -0
  21. data/lib/ffaker/data/name_pl/female_first_names +121 -0
  22. data/lib/ffaker/data/name_pl/female_last_names +200 -0
  23. data/lib/ffaker/data/name_pl/male_first_names +121 -0
  24. data/lib/ffaker/data/name_pl/male_last_names +200 -0
  25. data/lib/ffaker/filesystem.rb +25 -0
  26. data/lib/ffaker/html_ipsum.rb +7 -7
  27. data/lib/ffaker/identification_mx.rb +2 -2
  28. data/lib/ffaker/name_da.rb +1 -1
  29. data/lib/ffaker/name_gr.rb +1 -1
  30. data/lib/ffaker/name_mx.rb +1 -1
  31. data/lib/ffaker/name_pl.rb +99 -0
  32. data/lib/ffaker/phone_number_au.rb +2 -2
  33. data/lib/ffaker/phone_number_id.rb +1 -1
  34. data/lib/ffaker/string.rb +1 -1
  35. data/lib/ffaker/tweet.rb +1 -1
  36. data/scripts/reference.rb +4 -4
  37. data/test/test_address_br.rb +1 -1
  38. data/test/test_address_ca.rb +2 -1
  39. data/test/test_address_gr.rb +1 -1
  40. data/test/test_address_mx.rb +1 -1
  41. data/test/test_address_pl.rb +81 -0
  42. data/test/test_address_ua.rb +2 -1
  43. data/test/test_animal.rb +17 -0
  44. data/test/test_aws.rb +3 -3
  45. data/test/test_book.rb +2 -2
  46. data/test/test_filesystem.rb +28 -0
  47. data/test/test_lorem_fr.rb +2 -1
  48. data/test/test_name_br.rb +1 -1
  49. data/test/test_name_pl.rb +112 -0
  50. data/test/test_phone_number_au.rb +18 -13
  51. data/test/test_phone_number_cu.rb +6 -3
  52. metadata +26 -1
@@ -0,0 +1,121 @@
1
+ Adam
2
+ Adrian
3
+ Albert
4
+ Aleksander
5
+ Alfred
6
+ Alojzy
7
+ Amadeusz
8
+ Ambroży
9
+ Andrzej
10
+ Antoni
11
+ Artur
12
+ Bartłomiej
13
+ Bartosz
14
+ Benedykt
15
+ Bernard
16
+ Błażej
17
+ Bogdan
18
+ Bogumił
19
+ Bogusław
20
+ Bolesław
21
+ Bożydar
22
+ Bronisław
23
+ Cezary
24
+ Cyprian
25
+ Cyryl
26
+ Czesław
27
+ Damian
28
+ Daniel
29
+ Dariusz
30
+ Dawid
31
+ Dominik
32
+ Edmund
33
+ Edward
34
+ Emil
35
+ Eryk
36
+ Ferdynand
37
+ Filip
38
+ Franciszek
39
+ Fryderyk
40
+ Gaweł
41
+ Gerwazy
42
+ Gracjan
43
+ Grzegorz
44
+ Gustaw
45
+ Henryk
46
+ Hieronim
47
+ Horacy
48
+ Hubert
49
+ Ignacy
50
+ Igor
51
+ Ildefons
52
+ Ireneusz
53
+ Iwo
54
+ Jacek
55
+ Jakub
56
+ Jan
57
+ Janusz
58
+ Jarosław
59
+ Jerzy
60
+ Jędrzej
61
+ Józef
62
+ Julian
63
+ Kacper
64
+ Kajetan
65
+ Kamil
66
+ Karol
67
+ Kazimierz
68
+ Konrad
69
+ Krzysztof
70
+ Lech
71
+ Leon
72
+ Leopold
73
+ Lew
74
+ Lucjan
75
+ Ludwik
76
+ Łukasz
77
+ Maciej
78
+ Maksymilian
79
+ Marcin
80
+ Marek
81
+ Marian
82
+ Mariusz
83
+ Mateusz
84
+ Michał
85
+ Mieczysław
86
+ Mikołaj
87
+ Miłosz
88
+ Mirosław
89
+ Norbert
90
+ Oskar
91
+ Patryk
92
+ Paweł
93
+ Piotr
94
+ Przemysław
95
+ Radosław
96
+ Rafał
97
+ Robert
98
+ Roman
99
+ Ryszard
100
+ Sebastian
101
+ Sławomir
102
+ Stanisław
103
+ Sylwester
104
+ Szczepan
105
+ Szymon
106
+ Tadeusz
107
+ Tobiasz
108
+ Tomasz
109
+ Tymoteusz
110
+ Wacław
111
+ Waldemar
112
+ Walerian
113
+ Wiesław
114
+ Wiktor
115
+ Witold
116
+ Władysław
117
+ Włodzimierz
118
+ Wojciech
119
+ Zbigniew
120
+ Zdzisław
121
+ Zygmunt
@@ -0,0 +1,200 @@
1
+ Adamiec
2
+ Adamiuk
3
+ Adamowski
4
+ Andrzejewski
5
+ Arciszewski
6
+ Bachleda
7
+ Badowski
8
+ Bagiński
9
+ Baran
10
+ Bielecki
11
+ Biernacki
12
+ Błach
13
+ Błaszyczykowski
14
+ Boguski
15
+ Borowski
16
+ Buczkowski
17
+ Butkiewicz
18
+ Chełmicki
19
+ Chmiel
20
+ Chomicki
21
+ Ciechanowski
22
+ Czachowski
23
+ Czerwiński
24
+ Dąbek
25
+ Dąbrowski
26
+ Dębski
27
+ Dobrzański
28
+ Domagalski
29
+ Dudek
30
+ Dutkiewicz
31
+ Filipowicz
32
+ Fornalski
33
+ Frankowski
34
+ Frydrych
35
+ Gadowski
36
+ Galiński
37
+ Gałczyński
38
+ Gawlik
39
+ Gawłowski
40
+ Giedroyć
41
+ Glinka
42
+ Godlewski
43
+ Gombrowicz
44
+ Grzesiak
45
+ Halicki
46
+ Hernik
47
+ Ignatowicz
48
+ Iwański
49
+ Jabłczyński
50
+ Jabłoński
51
+ Janicki
52
+ Jankowski
53
+ Janowski
54
+ Jastrzębski
55
+ Józefowicz
56
+ Jurczyk
57
+ Kaczmarek
58
+ Kaczmarski
59
+ Kaczorowski
60
+ Kalinowski
61
+ Karpiński
62
+ Karwowski
63
+ Kasprowicz
64
+ Kijowski
65
+ Klimaszewski
66
+ Kłosiński
67
+ Kłosowski
68
+ Kmiecik
69
+ Kołłątaj
70
+ Kołodziejski
71
+ Kononowicz
72
+ Korwin
73
+ Koszewski
74
+ Kot
75
+ Kowal
76
+ Kowalczyk
77
+ Kowalski
78
+ Kownacki
79
+ Kozakiewicz
80
+ Kozłowski
81
+ Krajewski
82
+ Krasiński
83
+ Kraszewski
84
+ Krauze
85
+ Krawczyk
86
+ Królikowski
87
+ Kucharski
88
+ Kukiz
89
+ Kurowski
90
+ Kuźniar
91
+ Kwiatkowski
92
+ Lewandowski
93
+ Łazarczyk
94
+ Łuczak
95
+ Maciejewski
96
+ Mackiewicz
97
+ Makowski
98
+ Malczewski
99
+ Malinowski
100
+ Marciniak
101
+ Mazur
102
+ Mazurkiewicz
103
+ Mączyński
104
+ Michnik
105
+ Milewski
106
+ Młynarczyk
107
+ Motyka
108
+ Murawski
109
+ Musiał
110
+ Nawrocki
111
+ Nowacki
112
+ Nowak
113
+ Nowakowski
114
+ Nycz
115
+ Olejniczak
116
+ Olszewski
117
+ Orłowski
118
+ Ostrowski
119
+ Paprocki
120
+ Pazura
121
+ Piątek
122
+ Piechota
123
+ Piekarski
124
+ Pietrasiak
125
+ Pietrzykowski
126
+ Piwowarczyk
127
+ Pluta
128
+ Polański
129
+ Pośpiech
130
+ Radwański
131
+ Radziński
132
+ Raniszewski
133
+ Rataj
134
+ Regulski
135
+ Rogalski
136
+ Rudnicki
137
+ Rybicki
138
+ Ryś
139
+ Sadowski
140
+ Sarnowski
141
+ Sieradzki
142
+ Siudek
143
+ Smolarek
144
+ Smolik
145
+ Sobczak
146
+ Sopoćko
147
+ Starzyński
148
+ Stoch
149
+ Stychlerz
150
+ Surma
151
+ Szcześniak
152
+ Szczęsny
153
+ Szymański
154
+ Śliwa
155
+ Ślusarski
156
+ Świerczyński
157
+ Tarczyński
158
+ Tarnowski
159
+ Tatarczyk
160
+ Terlecki
161
+ Topolski
162
+ Trzciński
163
+ Turowski
164
+ Tyszka
165
+ Urbaniak
166
+ Urbański
167
+ Waglewski
168
+ Walczak
169
+ Walicki
170
+ Waligórski
171
+ Waszkiewicz
172
+ Wesołowski
173
+ Wielopolski
174
+ Wierzbowski
175
+ Wilczyński
176
+ Wilk
177
+ Winnicki
178
+ Wiśniewski
179
+ Witkowski
180
+ Włodarczyk
181
+ Wodziński
182
+ Wojciechowski
183
+ Wolski
184
+ Woźniak
185
+ Wójcik
186
+ Wójtowicz
187
+ Wróblewski
188
+ Zagumny
189
+ Zajączkowski
190
+ Zaremba
191
+ Zarzecki
192
+ Zawadzki
193
+ Zawisza
194
+ Zawiślak
195
+ Zieliński
196
+ Ziopaja
197
+ Zych
198
+ Żmuda
199
+ Żukowski
200
+ Żurawski
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ module FFaker
4
+ module Filesystem
5
+ extend ModuleUtils
6
+ extend self
7
+
8
+ SLUG_DELIMITERS = %w(- _ .).freeze
9
+
10
+ def extension
11
+ fetch_sample(EXTENSION)
12
+ end
13
+
14
+ def mime_type
15
+ fetch_sample(MIME_TYPE)
16
+ end
17
+
18
+ def file_name(dir = nil, name = nil, ext = nil, directory_separator = '/')
19
+ dir = Internet.slug unless dir
20
+ name = Lorem.word.downcase unless name
21
+ ext ||= extension
22
+ [dir, name].join(directory_separator) + ".#{ext}"
23
+ end
24
+ end
25
+ end
@@ -117,13 +117,13 @@ module FFaker
117
117
  end
118
118
  body << content_tag_for(:pre) do |pre|
119
119
  pre << content_tag_for(:code) do |code|
120
- code << "
121
- ##{word} h1 a {
122
- display: block;
123
- width: 300px;
124
- height: 80px;
125
- }
126
- "
120
+ code << "
121
+ ##{word} h1 a {
122
+ display: block;
123
+ width: 300px;
124
+ height: 80px;
125
+ }
126
+ "
127
127
  end
128
128
  end
129
129
  body
@@ -15,7 +15,7 @@ module FFaker
15
15
  # http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
16
16
  # Registro Federal de Contribuyentes (R.F.C.) para persona física
17
17
  def rfc_persona_fisica
18
- consonants_n = CONSONANTS + ["Ñ"]
18
+ consonants_n = CONSONANTS + ['Ñ']
19
19
  all_letters = consonants_n + VOWELS
20
20
  date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d')
21
21
  [
@@ -30,7 +30,7 @@ module FFaker
30
30
  # http://es.wikipedia.org/wiki/Registro_Federal_de_Contribuyentes_(M%C3%A9xico)
31
31
  # Registro Federal de Contribuyentes (R.F.C.) para persona moral
32
32
  def rfc_persona_moral
33
- consonants_n_amp = CONSONANTS + ["Ñ", '&']
33
+ consonants_n_amp = CONSONANTS + ['Ñ', '&']
34
34
  all_letters = consonants_n_amp + VOWELS
35
35
  date = ::Time.at(rand * ::Time.now.to_f).strftime('%y%m%d')
36
36
  "#{fetch_sample(all_letters, count: 3).join}#{date}#{fetch_sample(HOMOCLAVE, count: 3).join}"
@@ -29,7 +29,7 @@ module FFaker
29
29
 
30
30
  def first_name(gender = :any)
31
31
  case gender
32
- when :any then (rand(2) == 0) ? first_name(:male) : first_name(:female)
32
+ when :any then rand(2) == 0 ? first_name(:male) : first_name(:female)
33
33
  when :male then fetch_sample(MALE_FIRST_NAMES)
34
34
  when :female then fetch_sample(FEMALE_FIRST_NAMES)
35
35
  else
@@ -9,7 +9,7 @@ module FFaker
9
9
  # Random full name (male or female). Arguments :male, :female, :any
10
10
  def full_name(gender = :any)
11
11
  case gender
12
- when :any then (rand(2) == 0) ? male_full_name : female_full_name
12
+ when :any then rand(2) == 0 ? male_full_name : female_full_name
13
13
  when :male then male_full_name
14
14
  when :female then female_full_name
15
15
  else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'
@@ -70,7 +70,7 @@ module FFaker
70
70
  # A single name according to gender parameter
71
71
  def name(gender = :any)
72
72
  case gender
73
- when :any then (rand(2) == 0) ? name(:male) : name(:female)
73
+ when :any then rand(2) == 0 ? name(:male) : name(:female)
74
74
  when :male then fetch_sample(MALE_FIRST_NAMES)
75
75
  when :female then fetch_sample(FEMALE_FIRST_NAMES)
76
76
  else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'
@@ -0,0 +1,99 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ module FFaker
5
+ # Author Walerian Sobczak <walerian.sobczak@gmail.com> github.com/walerian777
6
+ # Inspirations:
7
+ # https://pl.wiktionary.org/wiki/Indeks:Polski_-_Imiona
8
+ # https://pl.wiktionary.org/wiki/Kategoria:Polskie_nazwiska_m%C4%99skie
9
+ module NamePL
10
+ extend ModuleUtils
11
+ extend self
12
+
13
+ GENDERS = [:random, :female, :male].freeze
14
+ MALE_PREFIXES = %w(Pan).freeze
15
+ FEMALE_PREFIXES = %w(Pani).freeze
16
+ ACADEMIC_DEGREE_PREFIXES = %w(lic. inż. mgr mgr\ inż. dr dr\ hab. prof.).freeze
17
+ PREFIXES = (MALE_PREFIXES + FEMALE_PREFIXES + ACADEMIC_DEGREE_PREFIXES).freeze
18
+
19
+ # Generates a random full name for a given gender (random by default).
20
+ # Acceptable gender values: :random, :female, :male
21
+ def name(gender = :random)
22
+ name_for_gender(:full_name, gender)
23
+ end
24
+
25
+ alias full_name name
26
+
27
+ def name_with_prefix(gender = :random)
28
+ name_for_gender(:name_with_prefix, gender)
29
+ end
30
+
31
+ # Generates a random last name for a given gender (random by default).
32
+ # Acceptable gender values: :random, :female, :male
33
+ def last_name(gender = :random)
34
+ name_for_gender(:last_name, gender)
35
+ end
36
+
37
+ # Generates a random first name for a given gender (random by default).
38
+ # Acceptable gender values: :random, :female, :male
39
+ def first_name(gender = :random)
40
+ name_for_gender(:first_name, gender)
41
+ end
42
+
43
+ def female_name_with_prefix
44
+ "#{female_prefix} #{female_full_name}"
45
+ end
46
+
47
+ def male_name_with_prefix
48
+ "#{male_prefix} #{male_full_name}"
49
+ end
50
+
51
+ def female_full_name
52
+ "#{female_first_name} #{female_last_name}"
53
+ end
54
+
55
+ def male_full_name
56
+ "#{male_first_name} #{male_last_name}"
57
+ end
58
+
59
+ def female_first_name
60
+ fetch_sample(FEMALE_FIRST_NAMES)
61
+ end
62
+
63
+ def female_last_name
64
+ fetch_sample(FEMALE_LAST_NAMES)
65
+ end
66
+
67
+ def male_first_name
68
+ fetch_sample(MALE_FIRST_NAMES)
69
+ end
70
+
71
+ def male_last_name
72
+ fetch_sample(MALE_LAST_NAMES)
73
+ end
74
+
75
+ def prefix
76
+ fetch_sample(PREFIXES)
77
+ end
78
+
79
+ def female_prefix
80
+ fetch_sample(FEMALE_PREFIXES)
81
+ end
82
+
83
+ def male_prefix
84
+ fetch_sample(MALE_PREFIXES)
85
+ end
86
+
87
+ def academic_degree_prefix
88
+ fetch_sample(ACADEMIC_DEGREE_PREFIXES)
89
+ end
90
+
91
+ private
92
+
93
+ def name_for_gender(name_type, gender) # :nodoc:
94
+ raise(ArgumentError, "Gender must be one of: #{GENDERS}") unless GENDERS.include?(gender)
95
+ return send("#{gender}_#{name_type}") unless gender == :random
96
+ fetch_sample([send("female_#{name_type}"), send("male_#{name_type}")])
97
+ end
98
+ end
99
+ end