faker 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/lib/faker.rb +34 -0
  4. data/lib/faker/blockchain/tezos.rb +6 -6
  5. data/lib/faker/books/dune.rb +4 -6
  6. data/lib/faker/books/lovecraft.rb +17 -33
  7. data/lib/faker/default/address.rb +10 -15
  8. data/lib/faker/default/alphanumeric.rb +6 -12
  9. data/lib/faker/default/app.rb +4 -11
  10. data/lib/faker/default/avatar.rb +6 -19
  11. data/lib/faker/default/bank.rb +4 -6
  12. data/lib/faker/default/boolean.rb +2 -3
  13. data/lib/faker/default/chile_rut.rb +6 -14
  14. data/lib/faker/default/code.rb +7 -13
  15. data/lib/faker/default/commerce.rb +8 -17
  16. data/lib/faker/default/company.rb +4 -6
  17. data/lib/faker/default/crypto_coin.rb +6 -9
  18. data/lib/faker/default/date.rb +17 -28
  19. data/lib/faker/default/demographic.rb +2 -3
  20. data/lib/faker/default/driving_licence.rb +5 -15
  21. data/lib/faker/default/file.rb +9 -26
  22. data/lib/faker/default/fillmurray.rb +4 -11
  23. data/lib/faker/default/finance.rb +2 -3
  24. data/lib/faker/default/hipster.rb +21 -54
  25. data/lib/faker/default/id_number.rb +5 -7
  26. data/lib/faker/default/internet.rb +30 -65
  27. data/lib/faker/default/invoice.rb +7 -13
  28. data/lib/faker/default/json.rb +9 -16
  29. data/lib/faker/default/lorem.rb +30 -70
  30. data/lib/faker/default/lorem_flickr.rb +17 -48
  31. data/lib/faker/default/lorem_pixel.rb +7 -23
  32. data/lib/faker/default/markdown.rb +3 -7
  33. data/lib/faker/default/measurement.rb +16 -24
  34. data/lib/faker/default/name.rb +2 -3
  35. data/lib/faker/default/nhs.rb +2 -3
  36. data/lib/faker/default/number.rb +25 -50
  37. data/lib/faker/default/omniauth.rb +25 -63
  38. data/lib/faker/default/phone_number.rb +2 -3
  39. data/lib/faker/default/placeholdit.rb +6 -19
  40. data/lib/faker/default/relationship.rb +2 -3
  41. data/lib/faker/default/source.rb +8 -12
  42. data/lib/faker/default/string.rb +2 -3
  43. data/lib/faker/default/stripe.rb +8 -12
  44. data/lib/faker/default/time.rb +17 -48
  45. data/lib/faker/default/twitter.rb +23 -32
  46. data/lib/faker/default/types.rb +12 -23
  47. data/lib/faker/default/vehicle.rb +8 -14
  48. data/lib/faker/default/world_cup.rb +5 -10
  49. data/lib/faker/games/dota.rb +2 -3
  50. data/lib/faker/movies/star_wars.rb +3 -6
  51. data/lib/faker/version.rb +1 -1
  52. data/lib/locales/en/science.yml +1 -1
  53. metadata +13 -13
@@ -9,7 +9,7 @@ module Faker
9
9
  VIN_LETTERS = 'ABCDEFGHJKLMNPRSTUVWXYZ'
10
10
  VIN_MAP = '0123456789X'
11
11
  VIN_WEIGHTS = '8765432X098765432'
12
- VIN_REGEX = /^[A-Z0-9]{3}[A-Z0-9]{5}[A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-0]{1}[A-Z0-9]{1}\d{5}$/
12
+ VIN_REGEX = /^[A-Z0-9]{3}[A-Z0-9]{5}[A-Z0-9]{1}[A-Z0-9]{1}[A-Z0-0]{1}[A-Z0-9]{1}\d{5}$/.freeze
13
13
  SG_CHECKSUM_WEIGHTS = [3, 14, 2, 12, 2, 11, 1].freeze
14
14
  SG_CHECKSUM_CHARS = 'AYUSPLJGDBZXTRMKHEC'
15
15
 
@@ -27,9 +27,8 @@ module Faker
27
27
  end
28
28
 
29
29
  def model(legacy_make_of_model = NOT_GIVEN, make_of_model: '')
30
- if legacy_make_of_model != NOT_GIVEN
31
- warn_with_uplevel 'Passing `make_of_model` with the 1st argument of `Vehicle.model` is deprecated. Use keyword argument like `Vehicle.model(make_of_model: ...)` instead.', uplevel: 1
32
- make_of_model = legacy_make_of_model
30
+ warn_for_deprecated_arguments do |keywords|
31
+ keywords << :make_of_model if legacy_make_of_model != NOT_GIVEN
33
32
  end
34
33
 
35
34
  return fetch("vehicle.models_by_make.#{make}") if make_of_model.empty?
@@ -91,13 +90,9 @@ module Faker
91
90
  end
92
91
 
93
92
  def mileage(legacy_min = NOT_GIVEN, legacy_max = NOT_GIVEN, min: MILEAGE_MIN, max: MILEAGE_MAX)
94
- if legacy_min != NOT_GIVEN
95
- warn_with_uplevel 'Passing `min` with the 1st argument of `Vehicle.mileage` is deprecated. Use keyword argument like `Vehicle.mileage(min: ...)` instead.', uplevel: 1
96
- min = legacy_min
97
- end
98
- if legacy_max != NOT_GIVEN
99
- warn_with_uplevel 'Passing `max` with the 2nd argument of `Vehicle.mileage` is deprecated. Use keyword argument like `Vehicle.mileage(max: ...)` instead.', uplevel: 1
100
- max = legacy_max
93
+ warn_for_deprecated_arguments do |keywords|
94
+ keywords << :min if legacy_min != NOT_GIVEN
95
+ keywords << :max if legacy_max != NOT_GIVEN
101
96
  end
102
97
 
103
98
  rand_in_range(min, max)
@@ -106,9 +101,8 @@ module Faker
106
101
  alias kilometrage mileage
107
102
 
108
103
  def license_plate(legacy_state_abreviation = NOT_GIVEN, state_abreviation: '')
109
- if legacy_state_abreviation != NOT_GIVEN
110
- warn_with_uplevel 'Passing `state_abreviation` with the 1st argument of `Vehicle.license_plate` is deprecated. Use keyword argument like `Vehicle.license_plate(state_abreviation: ...)` instead.', uplevel: 1
111
- state_abreviation = legacy_state_abreviation
104
+ warn_for_deprecated_arguments do |keywords|
105
+ keywords << :state_abreviation if legacy_state_abreviation != NOT_GIVEN
112
106
  end
113
107
 
114
108
  return regexify(bothify(fetch('vehicle.license_plate'))) if state_abreviation.empty?
@@ -16,22 +16,17 @@ module Faker
16
16
  end
17
17
 
18
18
  def group(legacy_group = NOT_GIVEN, group: 'group_A')
19
- if legacy_group != NOT_GIVEN
20
- warn_with_uplevel 'Passing `group` with the 1st argument of `WorldCup.group` is deprecated. Use keyword argument like `WorldCup.group(group: ...)` instead.', uplevel: 1
21
- group = legacy_group
19
+ warn_for_deprecated_arguments do |keywords|
20
+ keywords << :group if legacy_group != NOT_GIVEN
22
21
  end
23
22
 
24
23
  fetch("world_cup.groups.#{group}")
25
24
  end
26
25
 
27
26
  def roster(legacy_country = NOT_GIVEN, legacy_type = NOT_GIVEN, country: 'Egypt', type: 'coach')
28
- if legacy_country != NOT_GIVEN
29
- warn_with_uplevel 'Passing `country` with the 1st argument of `WorldCup.roster` is deprecated. Use keyword argument like `WorldCup.roster(country: ...)` instead.', uplevel: 1
30
- country = legacy_country
31
- end
32
- if legacy_type != NOT_GIVEN
33
- warn_with_uplevel 'Passing `type` with the 2nd argument of `WorldCup.roster` is deprecated. Use keyword argument like `WorldCup.roster(type: ...)` instead.', uplevel: 1
34
- type = legacy_type
27
+ warn_for_deprecated_arguments do |keywords|
28
+ keywords << :country if legacy_country != NOT_GIVEN
29
+ keywords << :type if legacy_type != NOT_GIVEN
35
30
  end
36
31
 
37
32
  fetch("world_cup.rosters.#{country}.#{type}")
@@ -21,9 +21,8 @@ module Faker
21
21
  end
22
22
 
23
23
  def quote(legacy_hero = NOT_GIVEN, hero: 'abaddon')
24
- if legacy_hero != NOT_GIVEN
25
- warn_with_uplevel 'Passing `hero` with the 1st argument of `Dota.quote` is deprecated. Use keyword argument like `Dota.quote(hero: ...)` instead.', uplevel: 1
26
- hero = legacy_hero
24
+ warn_for_deprecated_arguments do |keywords|
25
+ keywords << :hero if legacy_hero != NOT_GIVEN
27
26
  end
28
27
 
29
28
  fetch("games.dota.#{hero}.quote")
@@ -45,9 +45,8 @@ module Faker
45
45
  end
46
46
 
47
47
  def quote(legacy_character = NOT_GIVEN, character: nil)
48
- if legacy_character != NOT_GIVEN
49
- warn_with_uplevel 'Passing `character` with the 1st argument of `StarWars.quote` is deprecated. Use keyword argument like `StarWars.quote(character: ...)` instead.', uplevel: 1
50
- character = legacy_character
48
+ warn_for_deprecated_arguments do |keywords|
49
+ keywords << :character if legacy_character != NOT_GIVEN
51
50
  end
52
51
 
53
52
  quoted_characters = translate('faker.star_wars.quotes')
@@ -62,9 +61,7 @@ module Faker
62
61
  character = k.to_s if v.include?(character)
63
62
  end
64
63
 
65
- unless quoted_characters.key?(character.to_sym)
66
- raise ArgumentError, "Character for quotes can be left blank or #{quoted_characters.keys.join(', ')}"
67
- end
64
+ raise ArgumentError, "Character for quotes can be left blank or #{quoted_characters.keys.join(', ')}" unless quoted_characters.key?(character.to_sym)
68
65
  end
69
66
 
70
67
  fetch('star_wars.quotes.' + character)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faker #:nodoc:
4
- VERSION = '2.2.1'
4
+ VERSION = '2.2.2'
5
5
  end
@@ -2,5 +2,5 @@ en:
2
2
  faker:
3
3
  science:
4
4
  element: ["Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminum", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"]
5
- element_symbol: [H, He, Li, Be, B, C, N, O, F, Ne, Na, Mg, Al, Si, P, S, Cl, Ar, K, Ca, Sc, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Ga, Ge, As, Se, Br, Kr, Rb, Sr, Y, Zr, Nb, Mo, Tc, Ru, Rh, Pd, Ag, Cd, In, Sn, Sb, Te, I, Xe, Cs, Ba, La, Ce, Pr, Nd, Pm, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb, Lu, Hf, Ta, W, Re, Os, Ir, Pt, Au, Hg, Tl, Pb, Bi, Po, At, Rn, Fr, Ra, Ac, Th, Pa, U, Np, Pu, Am, Cm, Bk, Cf, Es, Fm, Md, No, Lr, Rf, Db, Sg, Bh, Hs, Mt, Ds, Rg, Cn, Nh, Fl, Mc, Lv, Ts, Og]
5
+ element_symbol: [H, He, Li, Be, B, C, N, O, F, Ne, Na, Mg, Al, Si, P, S, Cl, Ar, K, Ca, Sc, Ti, V, Cr, Mn, Fe, Co, Ni, Cu, Zn, Ga, Ge, As, Se, Br, Kr, Rb, Sr, "Y", Zr, Nb, Mo, Tc, Ru, Rh, Pd, Ag, Cd, In, Sn, Sb, Te, I, Xe, Cs, Ba, La, Ce, Pr, Nd, Pm, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb, Lu, Hf, Ta, W, Re, Os, Ir, Pt, Au, Hg, Tl, Pb, Bi, Po, At, Rn, Fr, Ra, Ac, Th, Pa, U, Np, Pu, Am, Cm, Bk, Cf, Es, Fm, Md, "No", Lr, Rf, Db, Sg, Bh, Hs, Mt, Ds, Rg, Cn, Nh, Fl, Mc, Lv, Ts, Og]
6
6
  scientist: ["Isaac Newton", "Albert Einstein", "Neils Bohr", "Charles Darwin", "Louis Pasteur", "Sigmund Freud", "Galileo Galilei", "Antoine Laurent Lavoisier", "Johannes Kepler", "Nicolaus Copernicus", "Michael Faraday", "James Clerk Maxwell", "Claude Bernard", "Franz Boas", "Werner Heisenberg", "Linus Pauling", "Rudolf Virchow", "Erwin Schrodinger", "Ernest Rutherford", "Paul Dirac", "Andreas Vesalius", "Tycho Brahe", "Comte de Buffon", "Ludwig Boltzmann", "Max Planck", "Marie Curie", "William Herschel", "Charles Lyell", "Pierre Simon de Laplace", "Edwin Hubble", "Joseph J. Thomson", "Max Born", "Francis Crick", "Enrico Fermi", "Leonard Euler", "Justus Liebig", "Arthur Eddington", "William Harvey", "Marcello Malpighi", "Christiaan Huygens", "Carl Gauss (Karl Friedrich Gauss)", "Albrecht von Haller", "August Kekule", "Robert Koch", "Murray Gell-Mann", "Emil Fischer", "Dmitri Mendeleev", "Sheldon Glashow", "James Watson", "John Bardeen", "John von Neumann", "Richard Feynman", "Alfred Wegener", "Stephen Hawking", "Anton van Leeuwenhoek", "Max von Laue", "Gustav Kirchhoff", "Hans Bethe", "Euclid", "Gregor Mendel", "Heike Kamerlingh Onnes", "Thomas Hunt Morgan", "Hermann von Helmholtz", "Paul Ehrlich", "Ernst Mayr", "Charles Sherrington", "Theodosius Dobzhansky", "Max Delbruck", "Jean Baptiste Lamarck", "William Bayliss", "Noam Chomsky", "Frederick Sanger", "Lucretius", "John Dalton", "Louis Victor de Broglie", "Carl Linnaeus", "Jean Piaget", "George Gaylord Simpson", "Claude Levi-Strauss", "Lynn Margulis", "Karl Landsteiner", "Konrad Lorenz", "Edward O. Wilson", "Frederick Gowland Hopkins", "Gertrude Belle Elion", "Hans Selye", "J. Robert Oppenheimer", "Edward Teller", "Willard Libby", "Ernst Haeckel", "Jonas Salk", "Emil Kraepelin", "Trofim Lysenko", "Francis Galton", "Alfred Binet", "Alfred Kinsey", "Alexander Fleming", "B. F. Skinner", "Wilhelm Wundt", "Archimedes"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Curtis
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-31 00:00:00.000000000 Z
12
+ date: 2019-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0.8'
20
+ version: 1.6.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0.8'
27
+ version: 1.6.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -59,42 +59,42 @@ dependencies:
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 12.3.1
62
+ version: 12.3.3
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 12.3.1
69
+ version: 12.3.3
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rubocop
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.59.1
76
+ version: 0.74.0
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 0.59.1
83
+ version: 0.74.0
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: simplecov
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '='
89
89
  - !ruby/object:Gem::Version
90
- version: 0.16.1
90
+ version: 0.17.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - '='
96
96
  - !ruby/object:Gem::Version
97
- version: 0.16.1
97
+ version: 0.17.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: test-unit
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -536,7 +536,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
536
536
  - !ruby/object:Gem::Version
537
537
  version: '0'
538
538
  requirements: []
539
- rubygems_version: 3.0.3
539
+ rubygems_version: 3.0.4
540
540
  signing_key:
541
541
  specification_version: 4
542
542
  summary: Easily generate fake data