ffaker 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +5 -0
  3. data/README.md +8 -0
  4. data/REFERENCE.md +21 -1
  5. data/Rakefile +1 -1
  6. data/ffaker.gemspec +6 -6
  7. data/lib/ffaker.rb +2 -2
  8. data/lib/ffaker/address.rb +9 -9
  9. data/lib/ffaker/address_au.rb +2 -2
  10. data/lib/ffaker/address_br.rb +2 -2
  11. data/lib/ffaker/address_ca.rb +2 -2
  12. data/lib/ffaker/address_da.rb +2 -2
  13. data/lib/ffaker/address_de.rb +2 -2
  14. data/lib/ffaker/address_fi.rb +1 -2
  15. data/lib/ffaker/address_fr.rb +1 -1
  16. data/lib/ffaker/address_gr.rb +2 -2
  17. data/lib/ffaker/address_id.rb +1 -1
  18. data/lib/ffaker/address_in.rb +3 -5
  19. data/lib/ffaker/address_kr.rb +9 -8
  20. data/lib/ffaker/address_mx.rb +2 -2
  21. data/lib/ffaker/address_nl.rb +1 -1
  22. data/lib/ffaker/address_pl.rb +5 -5
  23. data/lib/ffaker/address_ru.rb +1 -1
  24. data/lib/ffaker/address_ua.rb +3 -3
  25. data/lib/ffaker/address_us.rb +2 -2
  26. data/lib/ffaker/avatar.rb +1 -1
  27. data/lib/ffaker/book.rb +2 -2
  28. data/lib/ffaker/boolean.rb +1 -1
  29. data/lib/ffaker/cheesy_lingo.rb +2 -2
  30. data/lib/ffaker/color.rb +2 -2
  31. data/lib/ffaker/company.rb +6 -6
  32. data/lib/ffaker/company_cn.rb +2 -2
  33. data/lib/ffaker/company_it.rb +18 -2
  34. data/lib/ffaker/company_se.rb +4 -4
  35. data/lib/ffaker/data/company_it/piva_office_codes +99 -0
  36. data/lib/ffaker/education.rb +8 -8
  37. data/lib/ffaker/filesystem.rb +3 -3
  38. data/lib/ffaker/food.rb +1 -1
  39. data/lib/ffaker/gender.rb +1 -1
  40. data/lib/ffaker/gender_br.rb +1 -1
  41. data/lib/ffaker/gender_cn.rb +1 -1
  42. data/lib/ffaker/gender_id.rb +1 -1
  43. data/lib/ffaker/gender_kr.rb +1 -1
  44. data/lib/ffaker/html_ipsum.rb +4 -4
  45. data/lib/ffaker/identification.rb +1 -1
  46. data/lib/ffaker/identification_br.rb +1 -1
  47. data/lib/ffaker/identification_es.rb +1 -1
  48. data/lib/ffaker/identification_es_cl.rb +2 -2
  49. data/lib/ffaker/identification_es_co.rb +5 -5
  50. data/lib/ffaker/identification_mx.rb +4 -4
  51. data/lib/ffaker/internet.rb +9 -9
  52. data/lib/ffaker/internet_se.rb +6 -8
  53. data/lib/ffaker/job_fr.rb +2 -2
  54. data/lib/ffaker/lorem.rb +2 -2
  55. data/lib/ffaker/lorem_ar.rb +2 -2
  56. data/lib/ffaker/lorem_cn.rb +2 -2
  57. data/lib/ffaker/lorem_fr.rb +2 -2
  58. data/lib/ffaker/lorem_kr.rb +2 -2
  59. data/lib/ffaker/lorem_ru.rb +2 -2
  60. data/lib/ffaker/lorem_ua.rb +3 -3
  61. data/lib/ffaker/movie.rb +7 -7
  62. data/lib/ffaker/name.rb +4 -11
  63. data/lib/ffaker/name_br.rb +2 -2
  64. data/lib/ffaker/name_cs.rb +13 -11
  65. data/lib/ffaker/name_da.rb +3 -3
  66. data/lib/ffaker/name_de.rb +2 -2
  67. data/lib/ffaker/name_fr.rb +2 -4
  68. data/lib/ffaker/name_ga.rb +3 -10
  69. data/lib/ffaker/name_gr.rb +3 -3
  70. data/lib/ffaker/name_id.rb +2 -2
  71. data/lib/ffaker/name_it.rb +3 -6
  72. data/lib/ffaker/name_mx.rb +8 -8
  73. data/lib/ffaker/name_nb.rb +3 -4
  74. data/lib/ffaker/name_nl.rb +5 -5
  75. data/lib/ffaker/name_ph.rb +4 -6
  76. data/lib/ffaker/name_pl.rb +4 -4
  77. data/lib/ffaker/name_ru.rb +14 -12
  78. data/lib/ffaker/name_se.rb +3 -4
  79. data/lib/ffaker/name_sn.rb +13 -19
  80. data/lib/ffaker/name_ua.rb +1 -1
  81. data/lib/ffaker/nato_alphabet.rb +2 -2
  82. data/lib/ffaker/phone_number.rb +16 -16
  83. data/lib/ffaker/phone_number_au.rb +7 -7
  84. data/lib/ffaker/phone_number_br.rb +7 -7
  85. data/lib/ffaker/phone_number_ch.rb +7 -7
  86. data/lib/ffaker/phone_number_cu.rb +10 -10
  87. data/lib/ffaker/phone_number_de.rb +2 -2
  88. data/lib/ffaker/phone_number_fr.rb +4 -4
  89. data/lib/ffaker/phone_number_id.rb +1 -1
  90. data/lib/ffaker/phone_number_kr.rb +4 -4
  91. data/lib/ffaker/phone_number_mx.rb +2 -2
  92. data/lib/ffaker/phone_number_nl.rb +3 -3
  93. data/lib/ffaker/phone_number_se.rb +3 -3
  94. data/lib/ffaker/phone_number_sg.rb +1 -1
  95. data/lib/ffaker/phone_number_sn.rb +5 -5
  96. data/lib/ffaker/product.rb +9 -9
  97. data/lib/ffaker/ssn_se.rb +4 -4
  98. data/lib/ffaker/string.rb +3 -3
  99. data/lib/ffaker/time.rb +6 -1
  100. data/lib/ffaker/utils/module_utils.rb +5 -0
  101. data/lib/ffaker/utils/unique_utils.rb +45 -0
  102. data/lib/ffaker/vehicle.rb +5 -5
  103. data/scripts/reference.rb +1 -1
  104. data/test/test_address_gr.rb +5 -5
  105. data/test/test_address_ja.rb +2 -1
  106. data/test/test_address_kr.rb +1 -0
  107. data/test/test_array_utils.rb +3 -3
  108. data/test/test_color.rb +1 -1
  109. data/test/test_company_it.rb +5 -1
  110. data/test/test_identification_es_mx.rb +1 -1
  111. data/test/test_module_utils.rb +1 -1
  112. data/test/test_name_ar.rb +4 -6
  113. data/test/test_name_cs.rb +2 -2
  114. data/test/test_name_ja.rb +2 -2
  115. data/test/test_name_ru.rb +2 -2
  116. data/test/test_phone_number.rb +2 -2
  117. data/test/test_string.rb +1 -1
  118. data/test/test_time.rb +9 -1
  119. data/test/test_unique_utils.rb +54 -0
  120. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fcc4779cc2c9c3b9d09d88027f366feaf1976ae
4
- data.tar.gz: e36c959c28305eb3a766f8b4f2e10c59de877540
3
+ metadata.gz: ddd9b72c20d0dc426b47fc5308d76c2316b7d205
4
+ data.tar.gz: 12ea70c65727acd2fe8b85820e34cb817df4e2d9
5
5
  SHA512:
6
- metadata.gz: 251f325ffc642f885713f57f87ad0138ef32c5d9a1fcbfa603a3da51376e3d4482d4a883a7473736095f705fa537980fe4c3bab3e64414c2009a3e9d54276973
7
- data.tar.gz: 77c72ce04507a31e82ae5c2b9196b685bd6d9ba1515d17ff1908844e75959c89ace969ab0a1fc6c650e119b26f27c14b5a70c4cdf4ebc11112b72b4868831c84
6
+ metadata.gz: 62ccce417b7a2850135e4a3ca09e41d6c2e85cf1c17bbc92b0ae4ac64d209e90b02729ef79d0f41da6ca72387c140f176ff05fb719674b9b87ab323d9962405c
7
+ data.tar.gz: b18b3d1833a69c1b967ecea20a5e0802c37fabcbdb21b365bf58b737e4b57cd4fe4754fde36431bca1cc288d7f04ca1e45352c6f2c4c234d04d763ccfc982894
@@ -1,3 +1,8 @@
1
+ ## 2.7.0
2
+ - Add unique method [@AlexAvlonitis]
3
+ - Add Time.day_of_week [@tvarley]
4
+ - Add CompanyIT.partita_iva [@aaronsama]
5
+
1
6
  ## 2.6.0
2
7
  - Add Polish names [@walerian777]
3
8
  - Add Polish addresses [@walerian777]
data/README.md CHANGED
@@ -63,6 +63,14 @@ name will be set with data from `ffaker/data/name/first_names`.
63
63
 
64
64
  To get repeatable results in Minitest or Rspec, follow [these instructions](RANDOM.md#using-the-same-random-seed-as-your-tests).
65
65
 
66
+ ## Unique results
67
+
68
+ You can get unique value from any methods in FFaker like this:
69
+
70
+ ```rb
71
+ FFaker::Name.unique.name
72
+ ```
73
+
66
74
  ## TODO
67
75
 
68
76
  * Even though the API is pretty simple, better rdoc documentation would not hurt.
@@ -26,7 +26,6 @@
26
26
  * [FFaker::AddressUS](#ffakeraddressus)
27
27
  * [FFaker::Airline](#ffakerairline)
28
28
  * [FFaker::Avatar](#ffakeravatar)
29
- * [FFaker::Lorem](#ffakerlorem)
30
29
  * [FFaker::BaconIpsum](#ffakerbaconipsum)
31
30
  * [FFaker::Book](#ffakerbook)
32
31
  * [FFaker::Boolean](#ffakerboolean)
@@ -70,6 +69,7 @@
70
69
  * [FFaker::JobKR](#ffakerjobkr)
71
70
  * [FFaker::JobVN](#ffakerjobvn)
72
71
  * [FFaker::Locale](#ffakerlocale)
72
+ * [FFaker::Lorem](#ffakerlorem)
73
73
  * [FFaker::LoremAR](#ffakerloremar)
74
74
  * [FFaker::LoremCN](#ffakerloremcn)
75
75
  * [FFaker::LoremFR](#ffakerloremfr)
@@ -501,6 +501,25 @@
501
501
  | `us_state_abbr` | ❗ *[state_abbr] is deprecated. For US addresses please use the AddressUS module* |
502
502
  | `zip_code` | 009928, 844785, 368696 |
503
503
 
504
+ ## FFaker::AddressJA
505
+
506
+ | Method | Example |
507
+ | ------ | ------- |
508
+ | `address` | 242-7131 東京都荒川区安曇野市282, 842-9567 広島県大津市鶴ヶ島市579, 622-8875 東京都東村山市吉野川市193 |
509
+ | `other_address` | 132-7798 石川県佐世保市西都市6丁目8番7号, 758-7677 長崎県日進市岐阜市5丁目2番6号, 159-6837 東京都甘楽郡宇陀市2丁目8番6号 |
510
+ | `designated_city_address` | 066-7675 沖縄県紀の川市南区善通寺市6丁目8番9号, 219-5096 宮城県桐生市湊区桐生市787, 672-0398 奈良県姫路市南区大府市797 |
511
+ | `tokyo_ward_address` | 661-4009 東京都葛飾区古賀市008, 955-3205 東京都港区大牟田市081, 917-4209 東京都板橋区水戸市505 |
512
+ | `postal_code` | 839-0750, 126-4278, 164-2480 |
513
+ | `land_number` | 287, 3丁目7番1号, 0丁目0番5号 |
514
+ | `street` | 小諸市, 防府市, あま市 |
515
+ | `tokyo_ward` | 板橋区, 世田谷区, 北区 |
516
+ | `ward` | 若林区, 港区, 城東区 |
517
+ | `village` | 留寿都村, 田野畑村, 宮田村 |
518
+ | `designated_city` | 上野原市, 岩見沢市, 八幡平市 |
519
+ | `city` | 奄美市, 我孫子市, 男鹿市 |
520
+ | `county` | 上北郡, 北安曇郡, 東臼杵郡 |
521
+ | `prefecture` | 石川県, 和歌山県, 滋賀県 |
522
+
504
523
  ## FFaker::AddressKR
505
524
 
506
525
  | Method | Example |
@@ -1919,6 +1938,7 @@
1919
1938
  | `date` | 2015-11-08 00:00:00 +0900, 2012-08-27 00:00:00 +0900, 2014-01-31 00:00:00 +0900 |
1920
1939
  | `datetime` | 2013-11-21 12:16:00 +0900, 2012-06-21 08:01:00 +0900, 2012-10-15 05:14:00 +0900 |
1921
1940
  | `month` | July, August, June |
1941
+ | `day_of_week` | Mon, Tue, Sat |
1922
1942
 
1923
1943
  ## FFaker::Tweet
1924
1944
 
data/Rakefile CHANGED
@@ -104,7 +104,7 @@ task release: :build do
104
104
  sh "gem push pkg/#{name}-#{version}.gem"
105
105
  end
106
106
 
107
- task build: [:gemspec, :reference] do
107
+ task build: %i[gemspec reference] do
108
108
  sh 'mkdir -p pkg'
109
109
  sh "gem build #{gemspec_file}"
110
110
  sh "mv #{gem_file} pkg"
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'ffaker'
7
- s.version = '2.6.0'
8
- s.date = '2017-02-20'
7
+ s.version = '2.7.0'
8
+ s.date = '2017-09-19'
9
9
  s.rubyforge_project = 'ffaker'
10
10
  s.required_ruby_version = '>= 1.9'
11
11
 
@@ -21,13 +21,13 @@ Gem::Specification.new do |s|
21
21
  s.email = 'EmmanuelOga@gmail.com'
22
22
  s.homepage = 'http://github.com/ffaker/ffaker'
23
23
 
24
- s.require_paths = %w(lib)
24
+ s.require_paths = %w[lib]
25
25
 
26
26
  s.rdoc_options = ['--charset=UTF-8']
27
- s.extra_rdoc_files = %w(README.md LICENSE Changelog.md)
27
+ s.extra_rdoc_files = %w[README.md LICENSE Changelog.md]
28
28
 
29
29
  # = MANIFEST =
30
- s.files = %w(
30
+ s.files = %w[
31
31
  Changelog.md
32
32
  Gemfile
33
33
  LICENSE
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  REFERENCE.md
36
36
  Rakefile
37
37
  ffaker.gemspec
38
- ) + Dir['lib/**/*', 'scripts/*']
38
+ ] + Dir['lib/**/*', 'scripts/*']
39
39
  # = MANIFEST =
40
40
 
41
41
  s.test_files = Dir['test/**/*']
@@ -10,14 +10,14 @@ module FFaker
10
10
 
11
11
  LETTERS = [*'a'..'z'].freeze
12
12
 
13
- HEX = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F).freeze
13
+ HEX = %w[0 1 2 3 4 5 6 7 8 9 A B C D E F].freeze
14
14
 
15
15
  def self.hexify(*masks)
16
16
  fetch_sample(masks.flatten).gsub(/#/) { fetch_sample(HEX) }
17
17
  end
18
18
 
19
19
  def self.numerify(*masks)
20
- fetch_sample(masks.flatten).gsub(/#/) { rand(10).to_s }
20
+ fetch_sample(masks.flatten).gsub(/#/) { rand(0..9).to_s }
21
21
  end
22
22
 
23
23
  def self.letterify(*masks)
@@ -5,8 +5,8 @@ module FFaker
5
5
  extend ModuleUtils
6
6
  extend self
7
7
 
8
- COMPASS_DIRECTIONS = %w(North East West South).freeze
9
- CITY_PREFIXES = COMPASS_DIRECTIONS + %w(New Lake Port)
8
+ COMPASS_DIRECTIONS = %w[North East West South].freeze
9
+ CITY_PREFIXES = COMPASS_DIRECTIONS + %w[New Lake Port]
10
10
  SEC_ADDR = ['Apt. ###', 'Suite ###'].freeze
11
11
 
12
12
  # @deprecated US specific address info. Moved into {AddressUS}
@@ -35,11 +35,11 @@ module FFaker
35
35
  end
36
36
 
37
37
  def city
38
- case rand(4)
39
- when 0 then '%s %s%s' % [city_prefix, Name.first_name, city_suffix]
40
- when 1 then '%s %s' % [city_prefix, Name.first_name]
41
- when 2 then '%s%s' % [Name.first_name, city_suffix]
42
- when 3 then '%s%s' % [Name.last_name, city_suffix]
38
+ case rand(0..3)
39
+ when 0 then format('%s %s%s', city_prefix, Name.first_name, city_suffix)
40
+ when 1 then format('%s %s', city_prefix, Name.first_name)
41
+ when 2 then format('%s%s', Name.first_name, city_suffix)
42
+ when 3 then format('%s%s', Name.last_name, city_suffix)
43
43
  end
44
44
  end
45
45
 
@@ -48,11 +48,11 @@ module FFaker
48
48
  end
49
49
 
50
50
  def building_number
51
- FFaker.numerify(('#' * rand(3)) << '###')
51
+ FFaker.numerify(('#' * rand(0..2)) << '###')
52
52
  end
53
53
 
54
54
  def street_name
55
- case rand(2)
55
+ case rand(0..1)
56
56
  when 0 then "#{Name.last_name} #{street_suffix}"
57
57
  when 1 then "#{Name.first_name} #{street_suffix}"
58
58
  end
@@ -15,7 +15,7 @@ module FFaker
15
15
  'Australian Capital Territory', 'New South Wales', 'Queensland',
16
16
  'South Australia', 'Tasmania', 'Victoria', 'Western Australia'
17
17
  ].freeze
18
- STATE_ABBR = %w(ACT NSW NT QLD SA TAS VIC WA).freeze
18
+ STATE_ABBR = %w[ACT NSW NT QLD SA TAS VIC WA].freeze
19
19
  # based on http://en.wikipedia.org/wiki/List_of_cities_in_Australia
20
20
  SUBURB = {
21
21
  'ACT' => {
@@ -89,7 +89,7 @@ module FFaker
89
89
 
90
90
  def postcode(st_abbr = nil)
91
91
  st_abbr ||= state_abbr
92
- POSTCODE[st_abbr][rand(POSTCODE[st_abbr].size)]
92
+ POSTCODE[st_abbr][rand(0...POSTCODE[st_abbr].size)]
93
93
  end
94
94
 
95
95
  def state
@@ -9,7 +9,7 @@ module FFaker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
- STREET_PREFIX = %w(Rua Avenida Travessa Alameda).freeze
12
+ STREET_PREFIX = %w[Rua Avenida Travessa Alameda].freeze
13
13
 
14
14
  def zip_code
15
15
  FFaker.numerify '#####-###'
@@ -32,7 +32,7 @@ module FFaker
32
32
  end
33
33
 
34
34
  def street
35
- case rand(1)
35
+ case rand(0..1)
36
36
  when 0 then "#{street_prefix} #{NameBR.name}"
37
37
  when 1 then "#{street_prefix} #{NameBR.first_name} #{NameBR.last_name} #{NameBR.last_name}"
38
38
  end
@@ -10,8 +10,8 @@ module FFaker
10
10
  extend self
11
11
 
12
12
  POSTAL_CODE_FORMAT = '?#? #?#'.freeze
13
- POSTAL_CODE_CHARS = %w(A B C E G H J K L M N P R S T V X Y).freeze
14
- PROVINCE_ABBRS = %w(NL NS PE NB QC ON MB SK AB BC YT NT NU).freeze
13
+ POSTAL_CODE_CHARS = %w[A B C E G H J K L M N P R S T V X Y].freeze
14
+ PROVINCE_ABBRS = %w[NL NS PE NB QC ON MB SK AB BC YT NT NU].freeze
15
15
 
16
16
  def postal_code
17
17
  FFaker.numerify(POSTAL_CODE_FORMAT.gsub('?') { fetch_sample(POSTAL_CODE_CHARS) })
@@ -9,7 +9,7 @@ module FFaker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
- REGION = %w(Hovedstaden Sjælland Syddanmark Midtjylland Nordjylland).freeze
12
+ REGION = %w[Hovedstaden Sjælland Syddanmark Midtjylland Nordjylland].freeze
13
13
  STATE = REGION
14
14
 
15
15
  def zip_code
@@ -41,7 +41,7 @@ module FFaker
41
41
  end
42
42
 
43
43
  def street_address
44
- "#{street_name} #{rand(100)}"
44
+ "#{street_name} #{rand(0..99)}"
45
45
  end
46
46
 
47
47
  def full_address
@@ -27,13 +27,13 @@ module FFaker
27
27
  end
28
28
 
29
29
  def street_address
30
- "#{street_name} #{1 + rand(192)}"
30
+ "#{street_name} #{rand(1..192)}"
31
31
  end
32
32
 
33
33
  private
34
34
 
35
35
  def random_type_of_street
36
- case rand(20)
36
+ case rand(0..19)
37
37
  when 0 then 'weg'
38
38
  when 1 then 'gasse'
39
39
  when 3 then 'hain'
@@ -13,11 +13,10 @@ module FFaker
13
13
  extend ModuleUtils
14
14
  extend self
15
15
 
16
- ZIP_FORMATS = ['#####'].freeze
17
16
  STREET_NBR_FORMATS = ['##', '#', '# a', '# b', '###', '# a #', '# b #'].freeze
18
17
 
19
18
  def zip_code
20
- FFaker.numerify(fetch_sample(ZIP_FORMATS))
19
+ FFaker.numerify('#####')
21
20
  end
22
21
 
23
22
  def city
@@ -12,7 +12,7 @@ module FFaker
12
12
  NUM = ['#', '##', '##', '###', '####', '#-##'].freeze
13
13
  MOD = [' B', ' T', ' Q', ' BIS', ' TER', ' QUATER', '', '', '', ''].freeze
14
14
  SEP = [', ', ' '].freeze
15
- TYPE = %w(rue avenue av boulevard bd impasse).freeze
15
+ TYPE = %w[rue avenue av boulevard bd impasse].freeze
16
16
  POSTAL_CODE_FORMATS = ['####', '#####', '97####', '2A###', '2B###'].freeze
17
17
 
18
18
  def street_address
@@ -9,8 +9,8 @@ module FFaker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
- STREET_PREFIX = [%w(Οδός Πάροδος)].freeze
13
- STREET_NUMBER = [%w(# ## ###)].freeze
12
+ STREET_PREFIX = [%w[Οδός Πάροδος]].freeze
13
+ STREET_NUMBER = [%w[# ## ###]].freeze
14
14
  STATE = REGION
15
15
 
16
16
  def zip_code
@@ -10,7 +10,7 @@ module FFaker
10
10
  extend ModuleUtils
11
11
  extend self
12
12
 
13
- STREET_PREFIX = %w(Jl Jln).freeze
13
+ STREET_PREFIX = %w[Jl Jln].freeze
14
14
 
15
15
  def zip_code
16
16
  FFaker.numerify '#####'
@@ -9,13 +9,11 @@ module FFaker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
- ZIP_FORMATS = ['######'].freeze
13
-
14
- def pincode
15
- FFaker.numerify(fetch_sample(ZIP_FORMATS))
12
+ def zip_code
13
+ FFaker.numerify('######')
16
14
  end
17
15
 
18
- alias zip_code pincode
16
+ alias pincode zip_code
19
17
 
20
18
  def state
21
19
  fetch_sample(STATE)
@@ -1,18 +1,19 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
+
3
4
  module FFaker
4
5
  module AddressKR
5
6
  extend ModuleUtils
6
7
  extend self
7
8
 
8
- BUILDING_DONGS = %w(가 나 다 라 마 바 ## ###).freeze
9
- BUILDING_SUFFIXES = %w(빌라 아파트 연립 마을 타운 타워).freeze
10
- STREET_SUFFIXES = %w(로 #로 가 #가 거리 길).freeze
11
- TOWN_SUFFIXES = %w(동 리 마을).freeze
12
- METROPOLITAN_CITIES = %w(서울특별시 부산광역시 대구광역시 인천광역시
13
- 광주광역시 대전광역시 울산광역시 세종특별자치시).freeze
14
- PROVINCES = %w(경기도 강원도 충청북도 충청남도 전라북도 전라남도 경상북도
15
- 경상남도 제주특별자치도).freeze
9
+ BUILDING_DONGS = %w[가 나 다 라 마 바 ## ###].freeze
10
+ BUILDING_SUFFIXES = %w[빌라 아파트 연립 마을 타운 타워].freeze
11
+ STREET_SUFFIXES = %w[로 #로 가 #가 거리 길].freeze
12
+ TOWN_SUFFIXES = %w[동 리 마을].freeze
13
+ METROPOLITAN_CITIES = %w[서울특별시 부산광역시 대구광역시 인천광역시
14
+ 광주광역시 대전광역시 울산광역시 세종특별자치시].freeze
15
+ PROVINCES = %w[경기도 강원도 충청북도 충청남도 전라북도 전라남도 경상북도
16
+ 경상남도 제주특별자치도].freeze
16
17
 
17
18
  def postal_code
18
19
  FFaker.numerify('#####')
@@ -25,7 +25,7 @@ module FFaker
25
25
 
26
26
  def municipality(st_abbr = nil)
27
27
  st_abbr ||= state_abbr
28
- MUNICIPALITY[st_abbr][rand(MUNICIPALITY[st_abbr].size)]
28
+ MUNICIPALITY[st_abbr][rand(0...MUNICIPALITY[st_abbr].size)]
29
29
  end
30
30
 
31
31
  MUNICIPALITY = {
@@ -35,7 +35,7 @@ module FFaker
35
35
  ],
36
36
  'BC' => ['Ensenada', 'Mexicali', 'Playas de Rosarito', 'Tecate', 'Tijuana'],
37
37
  'BCS' => ['Comondú', 'La Paz', 'Loreto', 'Los Cabos', 'Mulegé'],
38
- 'CAMP' => %w(Calakmul Calkiní Campeche Candelaria Carmen Champotón Escárcega Hecelchakán Hopelchén Palizada Tenabo),
38
+ 'CAMP' => %w[Calakmul Calkiní Campeche Candelaria Carmen Champotón Escárcega Hecelchakán Hopelchén Palizada Tenabo],
39
39
  'CHIS' => [
40
40
  'Acacoyagua', 'Acala', 'Acapetahua', 'Aldama',
41
41
  'Altamirano', 'Amatenango de la Frontera', 'Amatenango del Valle', 'Amatán', 'Angel Albino Corzo', 'Arriaga',
@@ -35,7 +35,7 @@ module FFaker
35
35
  private
36
36
 
37
37
  def random_type_of_street
38
- case rand(20)
38
+ case rand(0..19)
39
39
  when 0 then 'weg'
40
40
  when 1 then 'boulevard'
41
41
  when 3 then 'pad'
@@ -9,8 +9,8 @@ module FFaker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
- STREET_PREFIXES = %w(al. ul.).freeze
13
- SQUARE_PREFIXES = %w(bulwar pasaż plac skwer zaułek).freeze
12
+ STREET_PREFIXES = %w[al. ul.].freeze
13
+ SQUARE_PREFIXES = %w[bulwar pasaż plac skwer zaułek].freeze
14
14
 
15
15
  # Full Polish address with country name in French (according to Universal Postal Union).
16
16
  def full_address(include_country = false, include_secondary = false)
@@ -62,17 +62,17 @@ module FFaker
62
62
  end
63
63
 
64
64
  def secondary_number # :nodoc:
65
- case rand(2)
65
+ case rand(0..1)
66
66
  when 0 then " m. #{building_number}"
67
67
  when 1 then "/#{building_number}"
68
68
  end
69
69
  end
70
70
 
71
- def postal_code
71
+ def zip_code
72
72
  FFaker.numerify('##-###')
73
73
  end
74
74
 
75
- alias zip_code postal_code
75
+ alias postal_code zip_code
76
76
 
77
77
  def street_prefix
78
78
  fetch_sample(STREET_PREFIXES)
@@ -10,7 +10,7 @@ module FFaker
10
10
  extend self
11
11
 
12
12
  POSTAL_CODE_FORMAT = ['######'].freeze
13
- STREET_NBR_FORMATS = %w(## # ###).freeze
13
+ STREET_NBR_FORMATS = %w[## # ###].freeze
14
14
 
15
15
  def city
16
16
  fetch_sample(CITY)
@@ -8,8 +8,8 @@ module FFaker
8
8
  extend self
9
9
 
10
10
  POSTAL_CODE_FORMAT = ['#####'].freeze
11
- BUILDING_NUMBER_FORMATS = %w(## # ###).freeze
12
- APPARTMENT_NUMBER_FORMATS = %w(# ## ###).freeze
11
+ BUILDING_NUMBER_FORMATS = %w[## # ###].freeze
12
+ APPARTMENT_NUMBER_FORMATS = %w[# ## ###].freeze
13
13
 
14
14
  def country
15
15
  fetch_sample(COUNTRY)
@@ -51,7 +51,7 @@ module FFaker
51
51
  if allow_first_zero
52
52
  FFaker.numerify(masks_arr)
53
53
  else
54
- fetch_sample(masks_arr).sub(/#/) { (rand(9) + 1).to_s }.gsub(/#/) { rand(10).to_s }
54
+ fetch_sample(masks_arr).sub(/#/) { rand(1..9).to_s }.gsub(/#/) { rand(0..9).to_s }
55
55
  end
56
56
  end
57
57
  end