faker 2.8.0 → 2.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +185 -18
  3. data/README.md +1 -1
  4. data/lib/faker.rb +3 -5
  5. data/lib/faker/default/address.rb +215 -0
  6. data/lib/faker/default/ancient.rb +36 -0
  7. data/lib/faker/default/bank.rb +1 -1
  8. data/lib/faker/default/beer.rb +72 -0
  9. data/lib/faker/default/bossa_nova.rb +18 -0
  10. data/lib/faker/default/business.rb +27 -0
  11. data/lib/faker/default/chuck_norris.rb +11 -1
  12. data/lib/faker/default/color.rb +48 -1
  13. data/lib/faker/default/company.rb +236 -4
  14. data/lib/faker/default/crypto.rb +27 -0
  15. data/lib/faker/default/currency.rb +27 -0
  16. data/lib/faker/default/dc_comics.rb +45 -0
  17. data/lib/faker/default/demographic.rb +57 -0
  18. data/lib/faker/default/educator.rb +60 -6
  19. data/lib/faker/default/esport.rb +45 -0
  20. data/lib/faker/default/file.rb +2 -2
  21. data/lib/faker/default/fillmurray.rb +23 -1
  22. data/lib/faker/default/food.rb +65 -1
  23. data/lib/faker/default/gender.rb +13 -0
  24. data/lib/faker/default/internet.rb +13 -4
  25. data/lib/faker/default/job.rb +36 -0
  26. data/lib/faker/default/kpop.rb +54 -0
  27. data/lib/faker/default/lorem.rb +1 -1
  28. data/lib/faker/default/space.rb +127 -0
  29. data/lib/faker/default/team.rb +45 -0
  30. data/lib/faker/music/music.rb +90 -4
  31. data/lib/faker/music/opera.rb +36 -0
  32. data/lib/faker/version.rb +1 -1
  33. data/lib/helpers/unique_generator.rb +4 -0
  34. data/lib/locales/bg.yml +2 -2
  35. data/lib/locales/ca.yml +0 -8
  36. data/lib/locales/da-DK.yml +3 -3
  37. data/lib/locales/en-NEP.yml +1 -1
  38. data/lib/locales/en-NZ.yml +132 -8
  39. data/lib/locales/en-ZA.yml +1 -1
  40. data/lib/locales/en/address.yml +4 -0
  41. data/lib/locales/en/color.yml +1 -1
  42. data/lib/locales/en/educator.yml +69 -6
  43. data/lib/locales/en/gender.yml +1 -0
  44. data/lib/locales/en/phone_number.yml +1 -1
  45. data/lib/locales/en/shakespeare.yml +3 -3
  46. data/lib/locales/en/stripe.yml +3 -3
  47. data/lib/locales/es-MX.yml +3 -0
  48. data/lib/locales/fa.yml +2 -0
  49. data/lib/locales/fr-CA.yml +5 -4
  50. data/lib/locales/fr-CH.yml +1 -1
  51. data/lib/locales/fr.yml +5 -4
  52. data/lib/locales/hy.yml +1 -6
  53. data/lib/locales/id.yml +2 -1
  54. data/lib/locales/ja.yml +1 -1
  55. data/lib/locales/pt-BR.yml +23 -2
  56. data/lib/locales/pt.yml +2 -2
  57. data/lib/locales/uk.yml +5 -5
  58. data/lib/locales/zh-CN.yml +1 -1
  59. data/lib/locales/zh-TW.yml +1 -1
  60. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29798f78b1587b989eb395b41be5d0851b1e8ce2ee6488d1a4291dcaca7e8713
4
- data.tar.gz: 67694fb9ec2495bd11a85278962b5941326e24891fce2f9f9fb5a9baa4efa424
3
+ metadata.gz: ee4c2c26c4b46e94dade5e3c88c03631b30dd4a911ab2a1c591f50d19f6545e4
4
+ data.tar.gz: 7f01d600b2a69c499d84bce4545b3b8768d9d66d2868c0842104587b0f485eb4
5
5
  SHA512:
6
- metadata.gz: 2e968a3d663d459014b85287e0e2867cbcd8198acf82efe1e342af18990aadf090ba60c3771af8d79587a2ee95e16638922993f061f1f8437e45464f5bfd7a60
7
- data.tar.gz: 2a66801d474d23dfae78a6fb4c0b74b3a59f2af066b679d31ef6ad9862037151c85a429beda138d771d76d5ae3e7aa111b27ccd85e0a0fb4984c7b304fe8fe22
6
+ metadata.gz: 2135ba4017e6de90e983929de295959dd3a45755f90ddc8f30a0c0f748417f7fcca6b7e80a92404f64b69647ca153fc138333665ed66dd93a20c62478d680847
7
+ data.tar.gz: e3362d7da1e672011d312a0edf0506451fcc93af2d49b2602ad34d5bc88659d3448d85c39d7349a95e9cd70b346749d9225cf434a6c6bab7b37d706f74634e85
@@ -1,24 +1,191 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.10.2](https://github.com/faker-ruby/faker/tree/v2.10.2) (2020-02-15)
4
+
5
+ This version:
6
+ - adds a few YARD docs
7
+ - fixes locales
8
+ - updates local dependencies
9
+
10
+ ## Chores
11
+
12
+ - [PR #1924](https://github.com/faker-ruby/faker/pull/1924) Use ruby's `File::Separator` rather than '/' as a default for direct [@swiknaba](https://github.com/swiknaba)
13
+
14
+ ## Documentation
15
+
16
+ - [PR #1913](https://github.com/faker-ruby/faker/pull/1913) Add YARD docs for Faker::DcComics [@ash-elangovan](https://github.com/ash-elangovan)
17
+
18
+ ## Update locales
19
+
20
+ - [PR #1934](https://github.com/faker-ruby/faker/pull/1934) Add street_address for en-nz locale [@psibi](https://github.com/psibi)
21
+ - [PR #1933](https://github.com/faker-ruby/faker/pull/1933) Make id locale consistent. [@psibi](https://github.com/psibi)
22
+ - [PR #1930](https://github.com/faker-ruby/faker/pull/1930) Remove spaces before apostrophes [@jrmhaig](https://github.com/jrmhaig)
23
+ - [PR #1927](https://github.com/faker-ruby/faker/pull/1927) zh-TW locale fix: Avoid double de-reference for name_with_middle [@psibi](https://github.com/psibi)
24
+ - [PR #1922](https://github.com/faker-ruby/faker/pull/1922) zh-CN locale fix: Directly refer to the expected values [@psibi](https://github.com/psibi)
25
+ - [PR #1921](https://github.com/faker-ruby/faker/pull/1921) uk locale fix: Make empty fields consistent [@psibi](https://github.com/psibi)
26
+ - [PR #1920](https://github.com/faker-ruby/faker/pull/1920) pt locale fix: Make city fields consistent with other [@psibi](https://github.com/psibi)
27
+ - [PR #1918](https://github.com/faker-ruby/faker/pull/1918) Make Japanese Lorem sentences look more natural [@rastamhadi](https://github.com/rastamhadi)
28
+ - [PR #1915](https://github.com/faker-ruby/faker/pull/1915) Add yard docs for Faker::Company [@kos31de](https://github.com/kos31de)
29
+ - [PR #1914](https://github.com/faker-ruby/faker/pull/1914) Data source fix for ha locale [@psibi](https://github.com/psibi)
30
+ - [PR #1911](https://github.com/faker-ruby/faker/pull/1911) Removed duplicate value [@ash-elangovan](https://github.com/ash-elangovan)
31
+ - [PR #1908](https://github.com/faker-ruby/faker/pull/1908) Add more colors [@tomcol](https://github.com/tomcol)
32
+ - [PR #1903](https://github.com/faker-ruby/faker/pull/1903) fr locale: pokemon's root key should be games [@connorshea](https://github.com/connorshea)
33
+ - [PR #1902](https://github.com/faker-ruby/faker/pull/1902) Remove empty string in phone_number formats [@psibi](https://github.com/psibi)
34
+ - [PR #1901](https://github.com/faker-ruby/faker/pull/1901) fr-CA locale fix: pokemon's root key should be games [@psibi](https://github.com/psibi)
35
+ - [PR #1900](https://github.com/faker-ruby/faker/pull/1900) Use postcode for en-ZA [@psibi](https://github.com/psibi)
36
+ - [PR #1899](https://github.com/faker-ruby/faker/pull/1899) Locale root name should be en-NEP [@psibi](https://github.com/psibi)
37
+ - [PR #1812](https://github.com/faker-ruby/faker/pull/1812) Add vat number rule for es-MX [@arandilopez](https://github.com/arandilopez)
38
+
39
+ ## Update local dependencies
40
+
41
+ - Update test-unit requirement from = 3.3.4 to = 3.3.5 (#1896)
42
+
43
+ ------------------------------------------------------------------------------
44
+
45
+ ## [v2.10.1](https://github.com/faker-ruby/faker/tree/v2.10.1) (2020-01-13)
46
+
47
+ This version:
48
+ - fixes locales
49
+ - updates local dependencies
50
+ - fixes warnings
51
+
52
+ ## Bug/Fixes
53
+
54
+ - [PR #1868](https://github.com/faker-ruby/faker/pull/1868) Fix a deprecation warning in unique_generator.rb related to the kwarg [@connorshea](https://github.com/connorshea)
55
+
56
+ ## Update Locales
57
+
58
+ - [PR #1800](https://github.com/faker-ruby/faker/pull/1800) Update diners_club and jcb test cards since they were updated in String [@santib](https://github.com/santib)
59
+ - [PR #1879](https://github.com/faker-ruby/faker/pull/1879) Field changes in da-DK locale [@psibi](https://github.com/psibi)
60
+ - [PR #1878](https://github.com/faker-ruby/faker/pull/1878) Fix name related files in ca locale [@psibi](https://github.com/psibi)
61
+ - [PR #1877](https://github.com/faker-ruby/faker/pull/1877) Fix the path names for bg.yml [@psibi](https://github.com/psibi)
62
+
63
+ ## Update local dependencies
64
+
65
+ - Allow all versions of i18n from 1.6 up to 2 (#1894) [@orien](https://github.com/orien)
66
+ - Update minitest requirement from = 5.13.0 to = 5.14.0 (#1904)
67
+ - Bump i18n from 1.8.1 to 1.8.2 (#1905)
68
+ - Bump i18n from 1.8.0 to 1.8.1 (#1895)
69
+ - Update i18n requirement from >= 1.6, < 1.8 to >= 1.6, < 1.9 (#1893)
70
+ - Update yard requirement from = 0.9.23 to = 0.9.24 (#1892)
71
+ - Update rubocop requirement from = 0.78.0 to = 0.79.0 (#1890)
72
+ - Update yard requirement from = 0.9.22 to = 0.9.23 (#1889)
73
+ - Update yard requirement from = 0.9.20 to = 0.9.22 (#1882)
74
+
75
+ ------------------------------------------------------------------------------
76
+
77
+ ## [v2.10.0](https://github.com/faker-ruby/faker/tree/v2.10.0) (2019-12-28)
78
+
79
+ This version:
80
+ - adds `Faker::Address.mail_box`
81
+ - adds YARD docs
82
+ - fix Ruby 2.7 warnings
83
+ - adds other minor changes
84
+
85
+ ## Bug/Fixes
86
+
87
+ - [PR #1876](https://github.com/faker-ruby/faker/pull/1876) Fix Ruby 2.7 deprecation warnings for the translate method. [@connorshea](https://github.com/connorshea)
88
+ - [PR #1867](https://github.com/faker-ruby/faker/pull/1867) Fix tests failing on Ruby 2.7 [@connorshea](https://github.com/connorshea)
89
+
90
+ ## Chores
91
+
92
+ - [PR #1866](https://github.com/faker-ruby/faker/pull/1866) Upgrade the Gemfile.lock to Bundler 2. [@connorshea](https://github.com/connorshea)
93
+
94
+ ## Documentation
95
+
96
+ - [PR #1873](https://github.com/faker-ruby/faker/pull/1873) Add YARD docs for `Faker::Music{,::Opera}` [@jas14](https://github.com/jas14)
97
+ - [PR #1862](https://github.com/faker-ruby/faker/pull/1862) Update phone number documentation [@aVigorousDev](https://github.com/aVigorousDev)
98
+
99
+ ## Feature Request
100
+
101
+ - [PR #1875](https://github.com/faker-ruby/faker/pull/1875) Add Ruby 2.7 to the CI test matrix. [@connorshea](https://github.com/connorshea)
102
+ - [PR #1568](https://github.com/faker-ruby/faker/pull/1568) Add `Faker::Address.mail_box` and some NZ locale updates [@mermop](https://github.com/mermop)
103
+
104
+ ## Refactoring
105
+
106
+ - [PR #1874](https://github.com/faker-ruby/faker/pull/1874) Extract constants in `Faker::Music` [@jas14](https://github.com/jas14)
107
+
108
+ ## Update local dependencies
109
+
110
+ Update rubocop requirement from = 0.77.0 to = 0.78.0 (#1869)
111
+
112
+ ------------------------------------------------------------------------------
113
+
114
+ ## [v2.9.0](https://github.com/faker-ruby/faker/tree/v2.9.0) (2019-12-16)
115
+
116
+ This version:
117
+ - adds `Faker::Gender.short_binary_type`
118
+ - adds a few YARD docs
119
+ - fix Faker::Educator issues
120
+ - update locales
121
+
122
+ ## Bug/Fixes
123
+
124
+ - [PR #1860](https://github.com/faker-ruby/faker/pull/1860) Fix Educator methods returning bad data. [@connorshea](https://github.com/connorshea)
125
+
126
+ ## Documentation
127
+
128
+ - [PR #1859](https://github.com/faker-ruby/faker/pull/1859) YYYY-MM-DD in CHANGELOG [@jas14](https://github.com/jas14)
129
+ - [PR #1797](https://github.com/faker-ruby/faker/pull/1797) add YARD doc for Faker::Job [@ashishra0](https://github.com/ashishra0)
130
+ - [PR #1790](https://github.com/faker-ruby/faker/pull/1790) add Faker::Beer YARD docs [@ashishra0](https://github.com/ashishra0)
131
+
132
+ ## Feature Request
133
+
134
+ - [PR #1863](https://github.com/faker-ruby/faker/pull/1863) Add Faker::Gender.short_binary_type [@bruno-b-martins](https://github.com/bruno-b-martins)
135
+
136
+ ## Update locales
137
+
138
+ - [PR #1864](https://github.com/faker-ruby/faker/pull/1864) adding `male` & `female` first names for persian [@alphamarket](https://github.com/alphamarket)
139
+
140
+ ------------------------------------------------------------------------------
141
+
142
+ ## [v2.8.1](https://github.com/faker-ruby/faker/tree/v2.8.1) (2019-12-06)
143
+
144
+ ## Bug/Fixes
145
+
146
+ - [PR #1846](https://github.com/faker-ruby/faker/pull/1846) Fix internet custom domain with suffix [@ngouy](https://github.com/ngouy)
147
+
148
+ ## Documentation
149
+
150
+ - [PR #1852](https://github.com/faker-ruby/faker/pull/1852) Add YARD docs for Faker::Business. [@connorshea](https://github.com/connorshea)
151
+ - [PR #1851](https://github.com/faker-ruby/faker/pull/1851) Add YARD docs for Faker::Crypto. [@connorshea](https://github.com/connorshea)
152
+ - [PR #1850](https://github.com/faker-ruby/faker/pull/1850) Add YARD docs for Faker::Kpop. [@connorshea](https://github.com/connorshea)
153
+ - [PR #1849](https://github.com/faker-ruby/faker/pull/1849) Add YARD docs for Faker::BossaNova. [@connorshea](https://github.com/connorshea)
154
+ - [PR #1848](https://github.com/faker-ruby/faker/pull/1848) Add YARD Docs for Faker::Demographic. [@connorshea](https://github.com/connorshea)
155
+ - [PR #1844](https://github.com/faker-ruby/faker/pull/1844) Fix yard doc in contribution [@vikas95prasad](https://github.com/vikas95prasad)
156
+ - [PR #1802](https://github.com/faker-ruby/faker/pull/1802) Add YARD doc for Faker::Food [@sap1enza](https://github.com/sap1enza)
157
+ - [PR #1766](https://github.com/faker-ruby/faker/pull/1766) Add YARD docs for Faker::Address [@connorshea](https://github.com/connorshea)
158
+
159
+ ## Refactoring
160
+
161
+ - [PR #1847](https://github.com/faker-ruby/faker/pull/1847) Makes minor refactors on Internet.domain_name method [@tiagofsilva](https://github.com/tiagofsilva)
162
+ - [PR #1772](https://github.com/faker-ruby/faker/pull/1848) Refactor Faker::Educator and add docs [@connorshea](https://github.com/connorshea)
163
+
164
+ ## Update local dependencies
165
+
166
+ - Update rubocop requirement from = 0.76.0 to = 0.77.0 (#1843)
167
+
168
+ ------------------------------------------------------------------------------
169
+
3
170
  ## [v2.8.0](https://github.com/faker-ruby/faker/tree/v2.8.0) (2019-12-01)
4
171
 
5
- ## Bugfixes
172
+ ## Bug/Fixes
6
173
 
7
- - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
174
+ - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
8
175
  Fix generating routing number [@psienko](https://github.com/psienko)
9
176
 
10
177
  ## Chores
11
178
 
12
- - [PR #1835](https://github.com/faker-ruby/faker/pull/1835)
179
+ - [PR #1835](https://github.com/faker-ruby/faker/pull/1835)
13
180
  Remove duplicate method description [@pacso](https://github.com/pacso)
14
181
 
15
182
  ## Documentation
16
183
 
17
- - [PR #1837](https://github.com/faker-ruby/faker/pull/1837)
184
+ - [PR #1837](https://github.com/faker-ruby/faker/pull/1837)
18
185
  docs: Internet #email, #domain do not control TLD [@olleolleolle](https://github.com/olleolleolle)
19
186
  - [PR #1833](https://github.com/faker-ruby/faker/pull/1833) Explain safe_email method [@swrobel](https://github.com/swrobel)
20
187
  - [PR #1810](https://github.com/faker-ruby/faker/pull/1810) Add yard docs for Faker::Coffee methods [@LuanGB](https://github.com/LuanGB)
21
- - [PR #1803](https://github.com/faker-ruby/faker/pull/1803)
188
+ - [PR #1803](https://github.com/faker-ruby/faker/pull/1803)
22
189
  add YARD doc for Faker::Coin [@sap1enza](https://github.com/sap1enza) [@connorshea](https://github.com/connorshea)
23
190
  - [PR #1799](https://github.com/faker-ruby/faker/pull/1799) Remove 'See below examples' for consistency [@DevUsmanGhani](https://github.com/DevUsmanGhani)
24
191
  - [PR #1793](https://github.com/faker-ruby/faker/pull/1793) add Faker::Relationship YARD docs [@DevUsmanGhani](https://github.com/DevUsmanGhani)
@@ -29,14 +196,14 @@ add YARD doc for Faker::Coin [@sap1enza](https://github.com/sap1enza) [@connorsh
29
196
 
30
197
  ## Update locales
31
198
 
32
- - [PR #1841](https://github.com/faker-ruby/faker/pull/1841)
199
+ - [PR #1841](https://github.com/faker-ruby/faker/pull/1841)
33
200
  Fix strange result from `Lorem.word` in ja locale [@yujideveloper](https://github.com/yujideveloper)
34
- - [PR #1839](https://github.com/faker-ruby/faker/pull/1839)
201
+ - [PR #1839](https://github.com/faker-ruby/faker/pull/1839)
35
202
  added new heroes, new maps and almost all of the quotes [@TCsTheMechanic](https://github.com/TCsTheMechanic)
36
203
 
37
204
  ## Update local dependencies
38
205
 
39
- - [PR #1831](https://github.com/faker-ruby/faker/pull/1831) Update rake requirement from = 13.0.0 to = 13.0.1 [@DevUsmanGhani](https://github.com/DevUsmanGhani)
206
+ - [PR #1831](https://github.com/faker-ruby/faker/pull/1831) Update rake requirement from = 13.0.0 to = 13.0.1 [@DevUsmanGhani](https://github.com/DevUsmanGhani)
40
207
 
41
208
  ------------------------------------------------------------------------------
42
209
 
@@ -97,7 +264,7 @@ The following development dependencies were updated:
97
264
 
98
265
  ------------------------------------------------------------------------------
99
266
 
100
- ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
267
+ ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-09-30)
101
268
 
102
269
  This version introduces:
103
270
  - locales for Thai language - the mother language in Thailand
@@ -131,7 +298,7 @@ The following development dependencies were updated:
131
298
 
132
299
  ------------------------------------------------------------------------------
133
300
 
134
- ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
301
+ ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-09-19)
135
302
 
136
303
  ## Documentation
137
304
 
@@ -156,7 +323,7 @@ The following development dependencies were updated:
156
323
 
157
324
  ------------------------------------------------------------------------------
158
325
 
159
- ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-12-09)
326
+ ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-09-12)
160
327
 
161
328
  ## Documentation
162
329
 
@@ -175,7 +342,7 @@ The following development dependencies were updated:
175
342
 
176
343
  ------------------------------------------------------------------------------
177
344
 
178
- ## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-05-09)
345
+ ## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-09-05)
179
346
 
180
347
  ## Bug/Fixes
181
348
 
@@ -199,7 +366,7 @@ The following development dependencies were updated:
199
366
 
200
367
  ------------------------------------------------------------------------------
201
368
 
202
- ## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-30-08)
369
+ ## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-08-30)
203
370
 
204
371
  ## Bug/Fixes
205
372
 
@@ -209,7 +376,7 @@ The following development dependencies were updated:
209
376
 
210
377
  Fixing number with one digit caused the test_insignificant_zero to fail. As it seemed that the behavior tested by test_insignificant_zero was already covered by test_number and test_decimal, we removed it to prevent duplication.
211
378
 
212
- ## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-25-08)
379
+ ## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-08-25)
213
380
 
214
381
  ## Deprecate
215
382
 
@@ -233,7 +400,7 @@ Add deprecation warning for positional arguments to notify users that are coming
233
400
 
234
401
  ------------------------------------------------------------------------------
235
402
 
236
- ## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-10-08)
403
+ ## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-08-10)
237
404
 
238
405
  ## Enhancements
239
406
 
@@ -243,7 +410,7 @@ Add deprecation warning for positional arguments to notify users that are coming
243
410
 
244
411
  We had to use `bundled with 1.7.3` to avoid some issues.
245
412
 
246
- ## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-10-08)
413
+ ## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-08-10)
247
414
 
248
415
  ## Bug/Fixes
249
416
 
@@ -261,7 +428,7 @@ Rollback Faker::Time changes because we should expect the date format from activ
261
428
 
262
429
  ------------------------------------------------------------------------------
263
430
 
264
- ## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-31-07)
431
+ ## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-07-31)
265
432
 
266
433
  ## Bug/Fixes
267
434
  - [PR #1675](https://github.com/faker-ruby/faker/pull/1675) Fix off-by-one error when formatting month names [@jutonz](https://github.com/jutonz)
@@ -270,7 +437,7 @@ This change required a quick release because it's a breaking issue. Every place
270
437
 
271
438
  ------------------------------------------------------------------------------
272
439
 
273
- ## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-31-07)
440
+ ## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-07-31)
274
441
 
275
442
  ## Important Note:
276
443
 
data/README.md CHANGED
@@ -43,7 +43,7 @@ development.
43
43
 
44
44
  ### NOTE
45
45
  * While Faker generates data at random, returned values are not guaranteed to be unique by default.
46
- You must explicity specify when you require unique values, see [details](#ensuring-unique-values).
46
+ You must explicitly specify when you require unique values, see [details](#ensuring-unique-values).
47
47
  Values also can be deterministic if you use the deterministic feature, see [details](#deterministic-random)
48
48
  * This is the `master` branch of Faker and may contain changes that are not yet released.
49
49
  Please refer the README of your version for the available methods.
@@ -151,20 +151,18 @@ module Faker
151
151
 
152
152
  # Call I18n.translate with our configured locale if no
153
153
  # locale is specified
154
- def translate(*args)
155
- opts = args.last.is_a?(Hash) ? args.pop : {}
154
+ def translate(*args, **opts)
156
155
  opts[:locale] ||= Faker::Config.locale
157
156
  opts[:raise] = true
158
- I18n.translate(*args.push(opts))
157
+ I18n.translate(*args, **opts)
159
158
  rescue I18n::MissingTranslationData
160
- opts = args.last.is_a?(Hash) ? args.pop : {}
161
159
  opts[:locale] = :en
162
160
 
163
161
  # Super-simple fallback -- fallback to en if the
164
162
  # translation was missing. If the translation isn't
165
163
  # in en either, then it will raise again.
166
164
  disable_enforce_available_locales do
167
- I18n.translate(*args.push(opts))
165
+ I18n.translate(*args, **opts)
168
166
  end
169
167
  end
170
168
 
@@ -5,6 +5,19 @@ module Faker
5
5
  flexible :address
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces the name of a city.
10
+ #
11
+ # @param options [Hash]
12
+ # @option with_state [Boolean] Whether to include the state name in the output.
13
+ # @return [String]
14
+ #
15
+ # @example
16
+ # Faker::Address.city #=> "Imogeneborough"
17
+ # Faker::Address.city(options: { with_state: true })
18
+ # #=> "Northfort, California"
19
+ #
20
+ # @faker.version 0.3.0
8
21
  def city(legacy_options = NOT_GIVEN, options: {})
9
22
  warn_for_deprecated_arguments do |keywords|
10
23
  keywords << :options if legacy_options != NOT_GIVEN
@@ -13,10 +26,29 @@ module Faker
13
26
  parse(options[:with_state] ? 'address.city_with_state' : 'address.city')
14
27
  end
15
28
 
29
+ ##
30
+ # Produces a street name.
31
+ #
32
+ # @return [String]
33
+ #
34
+ # @example
35
+ # Faker::Address.street_name #=> "Larkin Fork"
36
+ #
37
+ # @faker.version 0.3.0
16
38
  def street_name
17
39
  parse('address.street_name')
18
40
  end
19
41
 
42
+ ##
43
+ # Produces a street address.
44
+ #
45
+ # @param include_secondary [Boolean] Whether or not to include the secondary address.
46
+ # @return [String]
47
+ #
48
+ # @example
49
+ # Faker::Address.street_address #=> "282 Kevin Brook"
50
+ #
51
+ # @faker.version 0.3.0
20
52
  def street_address(legacy_include_secondary = NOT_GIVEN, include_secondary: false)
21
53
  warn_for_deprecated_arguments do |keywords|
22
54
  keywords << :include_secondary if legacy_include_secondary != NOT_GIVEN
@@ -25,18 +57,70 @@ module Faker
25
57
  numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
26
58
  end
27
59
 
60
+ ##
61
+ # Produces a secondary address.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Address.secondary_address #=> "Apt. 672"
67
+ #
68
+ # @faker.version 0.3.0
28
69
  def secondary_address
29
70
  bothify(fetch('address.secondary_address'))
30
71
  end
31
72
 
73
+ ##
74
+ # Produces a building number.
75
+ #
76
+ # @return [String]
77
+ #
78
+ # @example
79
+ # Faker::Address.building_number #=> "7304"
80
+ #
81
+ # @faker.version 0.3.0
32
82
  def building_number
33
83
  bothify(fetch('address.building_number'))
34
84
  end
35
85
 
86
+ ##
87
+ # Produces the name of a community.
88
+ #
89
+ # @return [String]
90
+ #
91
+ # @example
92
+ # Faker::Address.community #=> "University Crossing"
93
+ #
94
+ # @faker.version 1.8.0
36
95
  def community
37
96
  parse('address.community')
38
97
  end
39
98
 
99
+ ##
100
+ #
101
+ # Produces a mail box number.
102
+ # @return [String]
103
+ #
104
+ # @example
105
+ # Faker::Address.mail_box #=> "PO Box 123"
106
+ #
107
+ # @faker.version 2.9.1
108
+ def mail_box
109
+ bothify(fetch('address.mail_box'))
110
+ end
111
+
112
+ ##
113
+ # Produces a Zip Code.
114
+ #
115
+ # @param state_abbreviation [String] an abbreviation for a state where the zip code should be located.
116
+ # @return [String]
117
+ #
118
+ # @example
119
+ # Faker::Address.zip_code #=> "58517"
120
+ # Faker::Address.zip_code #=> "23285-4905"
121
+ # Faker::Address.zip_code(state_abbreviation: 'CO') #=> "80011"
122
+ #
123
+ # @faker.version 0.3.0
40
124
  def zip_code(legacy_state_abbreviation = NOT_GIVEN, state_abbreviation: '')
41
125
  warn_for_deprecated_arguments do |keywords|
42
126
  keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
@@ -52,6 +136,15 @@ module Faker
52
136
  bothify(fetch('address.postcode_by_state.' + state_abbreviation))
53
137
  end
54
138
 
139
+ ##
140
+ # Produces the name of a time zone.
141
+ #
142
+ # @return [String]
143
+ #
144
+ # @example
145
+ # Faker::Address.time_zone #=> "Asia/Yakutsk"
146
+ #
147
+ # @faker.version 1.2.0
55
148
  def time_zone
56
149
  fetch('address.time_zone')
57
150
  end
@@ -59,30 +152,96 @@ module Faker
59
152
  alias zip zip_code
60
153
  alias postcode zip_code
61
154
 
155
+ ##
156
+ # Produces a street suffix.
157
+ #
158
+ # @return [String]
159
+ #
160
+ # @example
161
+ # Faker::Address.street_suffix #=> "Street"
162
+ #
163
+ # @faker.version 0.3.0
62
164
  def street_suffix
63
165
  fetch('address.street_suffix')
64
166
  end
65
167
 
168
+ ##
169
+ # Produces a city suffix.
170
+ #
171
+ # @return [String]
172
+ #
173
+ # @example
174
+ # Faker::Address.city_suffix #=> "fort"
175
+ #
176
+ # @faker.version 0.3.0
66
177
  def city_suffix
67
178
  fetch('address.city_suffix')
68
179
  end
69
180
 
181
+ ##
182
+ # Produces a city prefix.
183
+ #
184
+ # @return [String]
185
+ #
186
+ # @example
187
+ # Faker::Address.city_prefix #=> "Lake"
188
+ #
189
+ # @faker.version 0.3.0
70
190
  def city_prefix
71
191
  fetch('address.city_prefix')
72
192
  end
73
193
 
194
+ ##
195
+ # Produces a state abbreviation.
196
+ #
197
+ # @return [String]
198
+ #
199
+ # @example
200
+ # Faker::Address.state_abbr #=> "AP"
201
+ #
202
+ # @faker.version 0.3.0
74
203
  def state_abbr
75
204
  fetch('address.state_abbr')
76
205
  end
77
206
 
207
+ ##
208
+ # Produces the name of a state.
209
+ #
210
+ # @return [String]
211
+ #
212
+ # @example
213
+ # Faker::Address.state #=> "California"
214
+ #
215
+ # @faker.version 0.3.0
78
216
  def state
79
217
  fetch('address.state')
80
218
  end
81
219
 
220
+ ##
221
+ # Produces the name of a country.
222
+ #
223
+ # @return [String]
224
+ #
225
+ # @example
226
+ # Faker::Address.country #=> "French Guiana"
227
+ #
228
+ # @faker.version 0.3.0
82
229
  def country
83
230
  fetch('address.country')
84
231
  end
85
232
 
233
+ ##
234
+ # Produces a country by ISO country code. See the
235
+ # [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
236
+ # on Wikipedia for a full list.
237
+ #
238
+ # @param code [String] An ISO country code.
239
+ # @return [String]
240
+ #
241
+ # @example
242
+ # Faker::Address.country_by_code(code: 'NL') #=> "Netherlands"
243
+ #
244
+ # @faker.version 1.9.2
86
245
  def country_by_code(legacy_code = NOT_GIVEN, code: 'US')
87
246
  warn_for_deprecated_arguments do |keywords|
88
247
  keywords << :code if legacy_code != NOT_GIVEN
@@ -91,6 +250,16 @@ module Faker
91
250
  fetch('address.country_by_code.' + code)
92
251
  end
93
252
 
253
+ ##
254
+ # Produces an ISO 3166 country code when given a country name.
255
+ #
256
+ # @param name [String] Country name in snake_case format.
257
+ # @return [String]
258
+ #
259
+ # @example
260
+ # Faker::Address.country_name_to_code(name: 'united_states') #=> "US"
261
+ #
262
+ # @faker.version 1.9.2
94
263
  def country_name_to_code(legacy_name = NOT_GIVEN, name: 'united_states')
95
264
  warn_for_deprecated_arguments do |keywords|
96
265
  keywords << :name if legacy_name != NOT_GIVEN
@@ -99,22 +268,68 @@ module Faker
99
268
  fetch('address.country_by_name.' + name)
100
269
  end
101
270
 
271
+ ##
272
+ # Produces an ISO 3166 country code.
273
+ #
274
+ # @return [String]
275
+ #
276
+ # @example
277
+ # Faker::Address.country_code #=> "IT"
278
+ #
279
+ # @faker.version 1.4.0
102
280
  def country_code
103
281
  fetch('address.country_code')
104
282
  end
105
283
 
284
+ ##
285
+ # Produces a long (alpha-3) ISO 3166 country code.
286
+ #
287
+ # @return [String]
288
+ #
289
+ # @example
290
+ # Faker::Address.country_code_long #=> "ITA"
291
+ #
292
+ # @faker.version 0.3.0
106
293
  def country_code_long
107
294
  fetch('address.country_code_long')
108
295
  end
109
296
 
297
+ ##
298
+ # Produces a latitude.
299
+ #
300
+ # @return [Float]
301
+ #
302
+ # @example
303
+ # Faker::Address.latitude #=> -58.17256227443719
304
+ #
305
+ # @faker.version 1.0.0
110
306
  def latitude
111
307
  ((rand * 180) - 90).to_f
112
308
  end
113
309
 
310
+ ##
311
+ # Produces a longitude.
312
+ #
313
+ # @return [Float]
314
+ #
315
+ # @example
316
+ # Faker::Address.longitude #=> -156.65548382095133
317
+ #
318
+ # @faker.version 1.0.0
114
319
  def longitude
115
320
  ((rand * 360) - 180).to_f
116
321
  end
117
322
 
323
+ ##
324
+ # Produces a full address.
325
+ #
326
+ # @return [String]
327
+ #
328
+ # @example
329
+ # Faker::Address.full_address
330
+ # #=> "282 Kevin Brook, Imogeneborough, CA 58517"
331
+ #
332
+ # @faker.version 0.3.0
118
333
  def full_address
119
334
  parse('address.full_address')
120
335
  end