ffaker 1.31.0 → 1.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/ffaker.gemspec +11 -3
  4. data/lib/ffaker.rb +2 -2
  5. data/lib/ffaker/address.rb +4 -6
  6. data/lib/ffaker/address_au.rb +26 -29
  7. data/lib/ffaker/address_br.rb +2 -2
  8. data/lib/ffaker/address_ca.rb +7 -3
  9. data/lib/ffaker/address_da.rb +6 -9
  10. data/lib/ffaker/address_de.rb +1 -3
  11. data/lib/ffaker/address_fi.rb +3 -3
  12. data/lib/ffaker/address_fr.rb +6 -6
  13. data/lib/ffaker/address_nl.rb +2 -2
  14. data/lib/ffaker/address_se.rb +3 -4
  15. data/lib/ffaker/address_uk.rb +3 -3
  16. data/lib/ffaker/address_us.rb +4 -4
  17. data/lib/ffaker/company.rb +4 -4
  18. data/lib/ffaker/company_it.rb +3 -4
  19. data/lib/ffaker/company_se.rb +2 -3
  20. data/lib/ffaker/currency.rb +16 -0
  21. data/lib/ffaker/data/address_ca/city +181 -0
  22. data/lib/ffaker/data/currency/currency_code +169 -0
  23. data/lib/ffaker/data/currency/currency_name +169 -0
  24. data/lib/ffaker/data/lorem_kr/words +47 -0
  25. data/lib/ffaker/education.rb +8 -7
  26. data/lib/ffaker/geolocation.rb +1 -1
  27. data/lib/ffaker/html_ipsum.rb +1 -1
  28. data/lib/ffaker/identification.rb +3 -3
  29. data/lib/ffaker/identification_es.rb +2 -3
  30. data/lib/ffaker/identification_es_co.rb +4 -3
  31. data/lib/ffaker/identification_mx.rb +4 -5
  32. data/lib/ffaker/internet.rb +7 -7
  33. data/lib/ffaker/internet_se.rb +8 -8
  34. data/lib/ffaker/job_fr.rb +1 -1
  35. data/lib/ffaker/lorem_kr.rb +36 -0
  36. data/lib/ffaker/movie.rb +6 -7
  37. data/lib/ffaker/name.rb +3 -3
  38. data/lib/ffaker/name_br.rb +2 -2
  39. data/lib/ffaker/name_cs.rb +11 -14
  40. data/lib/ffaker/name_da.rb +2 -1
  41. data/lib/ffaker/name_de.rb +2 -2
  42. data/lib/ffaker/name_fr.rb +1 -1
  43. data/lib/ffaker/name_ga.rb +1 -1
  44. data/lib/ffaker/name_it.rb +1 -1
  45. data/lib/ffaker/name_mx.rb +3 -3
  46. data/lib/ffaker/name_nb.rb +2 -2
  47. data/lib/ffaker/name_nl.rb +2 -2
  48. data/lib/ffaker/name_ru.rb +19 -18
  49. data/lib/ffaker/name_se.rb +2 -2
  50. data/lib/ffaker/name_sn.rb +2 -2
  51. data/lib/ffaker/nato_alphabet.rb +2 -2
  52. data/lib/ffaker/phone_number_cu.rb +133 -0
  53. data/lib/ffaker/phone_number_fr.rb +5 -5
  54. data/lib/ffaker/phone_number_it.rb +3 -3
  55. data/lib/ffaker/phone_number_nl.rb +6 -9
  56. data/lib/ffaker/phone_number_se.rb +12 -13
  57. data/lib/ffaker/product.rb +6 -6
  58. data/lib/ffaker/ssn_se.rb +2 -2
  59. data/lib/ffaker/string.rb +6 -6
  60. data/lib/ffaker/time.rb +2 -2
  61. data/lib/ffaker/unit.rb +13 -14
  62. data/lib/ffaker/unit_english.rb +35 -38
  63. data/lib/ffaker/unit_metric.rb +26 -30
  64. data/lib/ffaker/utils/array_utils.rb +1 -1
  65. data/lib/ffaker/vehicle.rb +7 -8
  66. data/test/test_address_ca.rb +4 -0
  67. data/test/test_identification_co.rb +7 -13
  68. data/test/test_lorem_kr.rb +47 -0
  69. data/test/test_name_cn.rb +9 -1
  70. data/test/test_phone_number_cu.rb +86 -0
  71. data/test/test_ssn_se.rb +6 -7
  72. metadata +13 -3
  73. data/lib/ffaker/course_fr.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1064c3313eac5491c732a59818f11bba706151b
4
- data.tar.gz: 997a984b9bfca54c52fe223541f7e011e9f9ee5a
3
+ metadata.gz: 568dac67518eecb802ba420ad1ee2fd3f879d115
4
+ data.tar.gz: af075d8208e0c4b3e6639ab769ee7656067c5889
5
5
  SHA512:
6
- metadata.gz: 38c9371dd3cf9107d8227ff3e21777ef0ad8946b09f4470d096c9b97b8060e59cbfbc1cc68f5a837bbc1fb9c512e1db5216116cee38762783e8b6af1f7fbd080
7
- data.tar.gz: 0c1e726a2bdffaf8c083fdce70304df22b6b88107af0f1f50da198fec67542f9f59eaad806d7c31ec3946eb97b56d5075c67a2e6b58399a1caf90b1121fa62a2
6
+ metadata.gz: d72c5ea4dbe993e7b8ef0b1c5a2c0d3aff55f9827ca7369a95689b8e375fc0657fc7ebe15173be6e21f8e782886d6fc4537cd0594fcd7dbfb496c4925945dc77
7
+ data.tar.gz: 713703c9dfb11d21d7c0250523278e1513814573c2d0444422736bb9ae72e4a6dc815394e63b85d7743013bcb5233dc81892faacb21a0bd8eaa971b6f9052906
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  [![Build Status](https://travis-ci.org/EmmanuelOga/ffaker.svg?branch=master)](https://travis-ci.org/EmmanuelOga/ffaker) [![Code Climate](https://codeclimate.com/github/EmmanuelOga/ffaker/badges/gpa.svg)](https://codeclimate.com/github/EmmanuelOga/ffaker)
2
2
  # ffaker
3
3
 
4
+ [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EmmanuelOga/ffaker?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+
4
6
  [ffaker](http://rubygems.org/gems/ffaker) is a rewrite of [faker](http://rubygems.org/gems/faker).
5
7
 
6
8
  ## Usage
data/ffaker.gemspec CHANGED
@@ -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 = '1.31.0'
8
- s.date = '2015-01-14'
7
+ s.version = '1.32.0'
8
+ s.date = '2015-02-04'
9
9
  s.rubyforge_project = 'ffaker'
10
10
 
11
11
  s.license = 'MIT'
@@ -52,8 +52,8 @@ Gem::Specification.new do |s|
52
52
  lib/ffaker/company_it.rb
53
53
  lib/ffaker/company_se.rb
54
54
  lib/ffaker/conference.rb
55
- lib/ffaker/course_fr.rb
56
55
  lib/ffaker/courses.rb
56
+ lib/ffaker/currency.rb
57
57
  lib/ffaker/data/address/city_suffixes
58
58
  lib/ffaker/data/address/country
59
59
  lib/ffaker/data/address/country_code
@@ -62,6 +62,7 @@ Gem::Specification.new do |s|
62
62
  lib/ffaker/data/address_br/city
63
63
  lib/ffaker/data/address_br/state
64
64
  lib/ffaker/data/address_br/state_abbr
65
+ lib/ffaker/data/address_ca/city
65
66
  lib/ffaker/data/address_ca/province
66
67
  lib/ffaker/data/address_da/city
67
68
  lib/ffaker/data/address_da/kommune
@@ -96,6 +97,8 @@ Gem::Specification.new do |s|
96
97
  lib/ffaker/data/company/catch_pre
97
98
  lib/ffaker/data/company/position_areas
98
99
  lib/ffaker/data/conference/conference_list
100
+ lib/ffaker/data/currency/currency_code
101
+ lib/ffaker/data/currency/currency_name
99
102
  lib/ffaker/data/dizzle_ipsum/dizzle_words
100
103
  lib/ffaker/data/education/major_noun
101
104
  lib/ffaker/data/education/school_suffix
@@ -120,6 +123,7 @@ Gem::Specification.new do |s|
120
123
  lib/ffaker/data/lorem_ar/words
121
124
  lib/ffaker/data/lorem_cn/words
122
125
  lib/ffaker/data/lorem_fr/words
126
+ lib/ffaker/data/lorem_kr/words
123
127
  lib/ffaker/data/mathematiques/lessons
124
128
  lib/ffaker/data/movie/adj_and_adv
125
129
  lib/ffaker/data/movie/nouns
@@ -210,6 +214,7 @@ Gem::Specification.new do |s|
210
214
  lib/ffaker/lorem_ar.rb
211
215
  lib/ffaker/lorem_cn.rb
212
216
  lib/ffaker/lorem_fr.rb
217
+ lib/ffaker/lorem_kr.rb
213
218
  lib/ffaker/movie.rb
214
219
  lib/ffaker/name.rb
215
220
  lib/ffaker/name_br.rb
@@ -234,6 +239,7 @@ Gem::Specification.new do |s|
234
239
  lib/ffaker/nato_alphabet.rb
235
240
  lib/ffaker/phone_number.rb
236
241
  lib/ffaker/phone_number_au.rb
242
+ lib/ffaker/phone_number_cu.rb
237
243
  lib/ffaker/phone_number_da.rb
238
244
  lib/ffaker/phone_number_de.rb
239
245
  lib/ffaker/phone_number_fr.rb
@@ -312,6 +318,7 @@ Gem::Specification.new do |s|
312
318
  test/test_lorem_ar.rb
313
319
  test/test_lorem_cn.rb
314
320
  test/test_lorem_fr.rb
321
+ test/test_lorem_kr.rb
315
322
  test/test_module_utils.rb
316
323
  test/test_movie.rb
317
324
  test/test_name.rb
@@ -335,6 +342,7 @@ Gem::Specification.new do |s|
335
342
  test/test_nato_alphabet.rb
336
343
  test/test_phone_number.rb
337
344
  test/test_phone_number_au.rb
345
+ test/test_phone_number_cu.rb
338
346
  test/test_phone_number_de.rb
339
347
  test/test_phone_number_kr.rb
340
348
  test/test_phone_number_mx.rb
data/lib/ffaker.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Faker
2
- VERSION = "1.31.0"
2
+ VERSION = "1.32.0"
3
3
 
4
4
  require 'ffaker/utils/array_utils'
5
5
  require 'ffaker/utils/module_utils'
@@ -8,7 +8,7 @@ module Faker
8
8
 
9
9
  BASE_LIB_PATH = File.expand_path("..", __FILE__)
10
10
 
11
- LETTERS = k('a'..'z')
11
+ LETTERS = [*'a'..'z']
12
12
 
13
13
  HEX = %w(0 1 2 3 4 5 6 7 8 9 A B C D E F)
14
14
 
@@ -5,6 +5,10 @@ module Faker
5
5
  extend ModuleUtils
6
6
  extend self
7
7
 
8
+ COMPASS_DIRECTIONS = %w(North East West South)
9
+ CITY_PREFIXES = COMPASS_DIRECTIONS + %w(New Lake Port)
10
+ SEC_ADDR = ['Apt. ###', 'Suite ###']
11
+
8
12
  # @deprecated US specific address info. Moved into {AddressUS}
9
13
  def zip_code
10
14
  warn '[zip_code] is deprecated. For US addresses please use the AddressUS module'
@@ -103,11 +107,5 @@ module Faker
103
107
  COUNTRY_CODE.sample
104
108
  end
105
109
  end
106
-
107
- COMPASS_DIRECTIONS = k %w(North East West South)
108
-
109
- CITY_PREFIXES = k(COMPASS_DIRECTIONS + %w(New Lake Port))
110
-
111
- SEC_ADDR = k ['Apt. ###', 'Suite ###']
112
110
  end
113
111
  end
@@ -10,38 +10,12 @@ module Faker
10
10
  extend ModuleUtils
11
11
  extend self
12
12
 
13
- def postcode(st_abbr = nil)
14
- st_abbr ||= state_abbr
15
- POSTCODE[st_abbr][rand(POSTCODE[st_abbr].size)]
16
- end
17
-
18
- def state
19
- STATE.sample
20
- end
21
-
22
- def state_abbr
23
- STATE_ABBR.sample
24
- end
25
-
26
- def suburb(st_abbr = nil, p_code = nil)
27
- st_abbr ||= state_abbr
28
- p_code ||= postcode(st_abbr)
29
- SUBURB[st_abbr][p_code]
30
- end
31
-
32
- def full_address(st_abbr = nil)
33
- st_abbr ||= state_abbr
34
- "#{Faker::Address.street_address}, #{suburb(st_abbr)} #{st_abbr} #{postcode}"
35
- end
36
-
37
13
  # based on areas labeled state (+act) here: http://en.wikipedia.org/wiki/States_and_territories_of_Australia
38
- STATE = k [
14
+ STATE = [
39
15
  'Australian Capital Territory', 'New South Wales', 'Queensland',
40
16
  'South Australia', 'Tasmania', 'Victoria', 'Western Australia'
41
17
  ]
42
-
43
- STATE_ABBR = k %w(ACT NSW NT QLD SA TAS VIC WA)
44
-
18
+ STATE_ABBR = %w(ACT NSW NT QLD SA TAS VIC WA)
45
19
  # based on http://en.wikipedia.org/wiki/List_of_cities_in_Australia
46
20
  SUBURB = {
47
21
  "ACT"=>{
@@ -100,7 +74,30 @@ module Faker
100
74
  "7310"=>"Devonport", "7320"=>"Burnie"
101
75
  }
102
76
  }
103
-
104
77
  POSTCODE = SUBURB.inject({}) { |h, (s_abbr, postcode_suburb_map)| h.update(s_abbr => postcode_suburb_map.keys) }
78
+
79
+ def postcode(st_abbr = nil)
80
+ st_abbr ||= state_abbr
81
+ POSTCODE[st_abbr][rand(POSTCODE[st_abbr].size)]
82
+ end
83
+
84
+ def state
85
+ STATE.sample
86
+ end
87
+
88
+ def state_abbr
89
+ STATE_ABBR.sample
90
+ end
91
+
92
+ def suburb(st_abbr = nil, p_code = nil)
93
+ st_abbr ||= state_abbr
94
+ p_code ||= postcode(st_abbr)
95
+ SUBURB[st_abbr][p_code]
96
+ end
97
+
98
+ def full_address(st_abbr = nil)
99
+ st_abbr ||= state_abbr
100
+ "#{Faker::Address.street_address}, #{suburb(st_abbr)} #{st_abbr} #{postcode}"
101
+ end
105
102
  end
106
103
  end
@@ -9,6 +9,8 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ STREET_PREFIX = %w( Rua Avenida Travessa Alameda )
13
+
12
14
  def zip_code
13
15
  Faker.numerify '#####-###'
14
16
  end
@@ -35,7 +37,5 @@ module Faker
35
37
  when 1 then "#{street_prefix} #{NameBR.first_name} #{NameBR.last_name} #{NameBR.last_name}"
36
38
  end
37
39
  end
38
-
39
- STREET_PREFIX = k %w( Rua Avenida Travessa Alameda )
40
40
  end
41
41
  end
@@ -9,6 +9,9 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ POSTAL_CODE_FORMATS = ['?#? #?#']
13
+ PROVINCE_ABBRS = %w(NL NS PE NB QC ON MB SK AB BC YT NT NU)
14
+
12
15
  def postal_code
13
16
  Faker.bothify(POSTAL_CODE_FORMATS.sample).upcase
14
17
  end
@@ -17,12 +20,13 @@ module Faker
17
20
  PROVINCE.sample
18
21
  end
19
22
 
23
+ def city
24
+ CITY.sample
25
+ end
26
+
20
27
  def province_abbr
21
28
  PROVINCE_ABBRS.sample
22
29
  end
23
30
 
24
- POSTAL_CODE_FORMATS = k ['?#? #?#']
25
-
26
- PROVINCE_ABBRS = k %w(NL NS PE NB QC ON MB SK AB BC YT NT NU)
27
31
  end
28
32
  end
@@ -9,8 +9,13 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ REGION = [
13
+ 'Hovedstaden', 'Sjælland', 'Syddanmark', 'Midtjylland', 'Nordjylland'
14
+ ]
15
+ STATE = REGION
16
+
12
17
  def zip_code
13
- Faker.numerify ZIP_FORMATS.sample
18
+ Faker.numerify('####')
14
19
  end
15
20
 
16
21
  def post_nr
@@ -33,8 +38,6 @@ module Faker
33
38
  CITY.sample
34
39
  end
35
40
 
36
- ZIP_FORMATS = k ['####']
37
-
38
41
  def street_name
39
42
  STREET.sample
40
43
  end
@@ -46,11 +49,5 @@ module Faker
46
49
  def full_address
47
50
  %Q{#{street_address} #{post_nr} #{city} #{region} DANMARK}
48
51
  end
49
-
50
- REGION = k [
51
- 'Hovedstaden', 'Sjælland', 'Syddanmark', 'Midtjylland', 'Nordjylland'
52
- ]
53
-
54
- STATE = REGION
55
52
  end
56
53
  end
@@ -10,7 +10,7 @@ module Faker
10
10
  extend self
11
11
 
12
12
  def zip_code
13
- Faker.numerify ZIP_FORMATS.sample
13
+ Faker.numerify '#####'
14
14
  end
15
15
 
16
16
  def state
@@ -36,7 +36,5 @@ module Faker
36
36
  def street_address
37
37
  "#{street_name} #{1+rand(192)}"
38
38
  end
39
-
40
- ZIP_FORMATS = k ['#####']
41
39
  end
42
40
  end
@@ -13,6 +13,9 @@ module Faker
13
13
  extend ModuleUtils
14
14
  extend self
15
15
 
16
+ ZIP_FORMATS = ['#####']
17
+ STREET_NBR_FORMATS = ['##', '#', '# a', '# b', '###', '# a #', '# b #']
18
+
16
19
  def zip_code
17
20
  Faker.numerify ZIP_FORMATS.sample
18
21
  end
@@ -41,8 +44,5 @@ module Faker
41
44
  COUNTRIES.sample
42
45
  end
43
46
 
44
- ZIP_FORMATS = k ['#####']
45
-
46
- STREET_NBR_FORMATS = k ['##', '#', '# a', '# b', '###', '# a #', '# b #']
47
47
  end
48
48
  end
@@ -9,6 +9,12 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ NUM = ['#', '##', '##', '###', '####', '#-##']
13
+ MOD = [' B', ' T', ' Q', ' BIS', ' TER', ' QUATER', '', '', '', '']
14
+ SEP = [', ', ' ']
15
+ TYPE = %w[rue avenue av boulevard bd impasse]
16
+ POSTAL_CODE_FORMATS = ['####', '#####', '97####', '2A###', '2B###']
17
+
12
18
  def street_address
13
19
  Faker.numerify(NUM.sample) +
14
20
  MOD.sample +
@@ -28,11 +34,5 @@ module Faker
28
34
  def full_address
29
35
  %Q{#{street_address}#{SEP.sample}#{postal_code} #{CITY.sample}}
30
36
  end
31
-
32
- NUM = k ['#', '##', '##', '###', '####', '#-##']
33
- MOD = k [' B', ' T', ' Q', ' BIS', ' TER', ' QUATER', '', '', '', '']
34
- SEP = k [', ', ' ']
35
- TYPE = k %w[rue avenue av boulevard bd impasse]
36
- POSTAL_CODE_FORMATS = k ['####', '#####', '97####', '2A###', '2B###']
37
37
  end
38
38
  end
@@ -9,6 +9,8 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ POSTAL_CODE_FORMAT = ['#### ??']
13
+
12
14
  def postal_code
13
15
  Faker.bothify POSTAL_CODE_FORMAT
14
16
  end
@@ -37,7 +39,5 @@ module Faker
37
39
  def province
38
40
  PROVINCE.sample
39
41
  end
40
-
41
- POSTAL_CODE_FORMAT = k ['#### ??']
42
42
  end
43
43
  end
@@ -13,6 +13,9 @@ module Faker
13
13
  extend ModuleUtils
14
14
  extend self
15
15
 
16
+ ZIP_FORMATS = ['#####', '## ###']
17
+ STREET_NBR_FORMATS = ['##', '#', '#a', '#b', '###']
18
+
16
19
  def zip_code
17
20
  Faker.numerify ZIP_FORMATS.sample
18
21
  end
@@ -40,9 +43,5 @@ module Faker
40
43
  def random_country
41
44
  COUNTRIES.sample
42
45
  end
43
-
44
- ZIP_FORMATS = k ['#####', '## ###']
45
-
46
- STREET_NBR_FORMATS = k ['##', '#', '#a', '#b', '###']
47
46
  end
48
47
  end
@@ -9,6 +9,9 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ COUNTRY = ['England', 'Scotland', 'Wales', 'Northern Ireland']
13
+ POSTCODE = ['??# #??', '??## #??']
14
+
12
15
  def county
13
16
  COUNTY.sample
14
17
  end
@@ -20,8 +23,5 @@ module Faker
20
23
  def postcode
21
24
  Faker.bothify(POSTCODE.sample).upcase
22
25
  end
23
-
24
- COUNTRY = k ['England', 'Scotland', 'Wales', 'Northern Ireland']
25
- POSTCODE = k ['??# #??', '??## #??']
26
26
  end
27
27
  end
@@ -9,6 +9,10 @@ module Faker
9
9
  extend ModuleUtils
10
10
  extend self
11
11
 
12
+ ZIP_FORMATS = ['#####', '#####-####']
13
+ CONTINENTAL_STATE = (STATE - ['Hawaii', 'Alaska'])
14
+ CONTINENTAL_STATE_ABBR = (STATE_ABBR - ['HI', 'AK'])
15
+
12
16
  def zip_code
13
17
  Faker.numerify ZIP_FORMATS.sample
14
18
  end
@@ -32,9 +36,5 @@ module Faker
32
36
  def continental_state_abbr
33
37
  CONTINENTAL_STATE_ABBR.sample
34
38
  end
35
-
36
- ZIP_FORMATS = k ['#####', '#####-####']
37
- CONTINENTAL_STATE = k (STATE - ['Hawaii', 'Alaska'])
38
- CONTINENTAL_STATE_ABBR = k (STATE_ABBR - ['HI', 'AK'])
39
39
  end
40
40
  end
@@ -5,6 +5,10 @@ module Faker
5
5
  extend ModuleUtils
6
6
  extend self
7
7
 
8
+ SUFFIXES = %w(Inc and\ Sons LLC Group)
9
+ POSITION_PREFIXES = %w[Executive Assistant General Associate]
10
+ POSITIONS = %w[President Manager Director Secretary Consultant]
11
+
8
12
  def name
9
13
  case rand(3)
10
14
  when 0 then "#{Name.last_name} #{suffix}"
@@ -37,9 +41,5 @@ module Faker
37
41
  end.join(' ')
38
42
  end
39
43
 
40
- SUFFIXES = k %w(Inc and\ Sons LLC Group)
41
-
42
- POSITION_PREFIXES = k %w[Executive Assistant General Associate]
43
- POSITIONS = k %w[President Manager Director Secretary Consultant]
44
44
  end
45
45
  end