faker 2.1.2 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +113 -7
- data/README.md +4 -4
- data/lib/faker.rb +56 -1
- data/lib/faker/blockchain/aeternity.rb +70 -0
- data/lib/faker/blockchain/bitcoin.rb +26 -0
- data/lib/faker/blockchain/ethereum.rb +10 -0
- data/lib/faker/blockchain/tezos.rb +62 -6
- data/lib/faker/books/book.rb +36 -0
- data/lib/faker/books/culture_series.rb +49 -0
- data/lib/faker/books/dune.rb +66 -5
- data/lib/faker/books/lovecraft.rb +210 -7
- data/lib/faker/creature/animal.rb +9 -0
- data/lib/faker/creature/cat.rb +27 -0
- data/lib/faker/creature/dog.rb +72 -0
- data/lib/faker/creature/horse.rb +18 -0
- data/lib/faker/default/address.rb +25 -5
- data/lib/faker/default/alphanumeric.rb +56 -7
- data/lib/faker/default/app.rb +54 -1
- data/lib/faker/default/appliance.rb +18 -0
- data/lib/faker/default/artist.rb +9 -0
- data/lib/faker/default/avatar.rb +42 -1
- data/lib/faker/default/bank.rb +10 -2
- data/lib/faker/default/boolean.rb +16 -1
- data/lib/faker/default/chile_rut.rb +12 -2
- data/lib/faker/default/code.rb +16 -3
- data/lib/faker/default/commerce.rb +17 -3
- data/lib/faker/default/company.rb +10 -2
- data/lib/faker/default/crypto_coin.rb +15 -3
- data/lib/faker/default/date.rb +37 -5
- data/lib/faker/default/demographic.rb +5 -1
- data/lib/faker/default/dessert.rb +27 -0
- data/lib/faker/default/device.rb +54 -0
- data/lib/faker/default/driving_licence.rb +10 -4
- data/lib/faker/default/electrical_components.rb +27 -0
- data/lib/faker/default/file.rb +19 -2
- data/lib/faker/default/fillmurray.rb +9 -1
- data/lib/faker/default/finance.rb +5 -1
- data/lib/faker/default/gender.rb +18 -0
- data/lib/faker/default/greek_philosophers.rb +18 -0
- data/lib/faker/default/hacker.rb +59 -1
- data/lib/faker/default/hipster.rb +45 -6
- data/lib/faker/default/house.rb +18 -0
- data/lib/faker/default/id_number.rb +11 -3
- data/lib/faker/default/industry_segments.rb +36 -0
- data/lib/faker/default/internet.rb +94 -13
- data/lib/faker/default/invoice.rb +16 -3
- data/lib/faker/default/json.rb +19 -2
- data/lib/faker/default/lorem.rb +81 -10
- data/lib/faker/default/lorem_flickr.rb +38 -5
- data/lib/faker/default/lorem_pixel.rb +10 -1
- data/lib/faker/default/markdown.rb +6 -1
- data/lib/faker/default/marketing.rb +9 -0
- data/lib/faker/default/measurement.rb +40 -8
- data/lib/faker/default/military.rb +45 -0
- data/lib/faker/default/name.rb +5 -1
- data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
- data/lib/faker/default/nhs.rb +5 -1
- data/lib/faker/default/number.rb +56 -11
- data/lib/faker/default/omniauth.rb +92 -9
- data/lib/faker/default/phone_number.rb +5 -1
- data/lib/faker/default/placeholdit.rb +11 -1
- data/lib/faker/default/programming_language.rb +18 -0
- data/lib/faker/default/relationship.rb +5 -1
- data/lib/faker/default/science.rb +27 -0
- data/lib/faker/default/source.rb +59 -3
- data/lib/faker/default/string.rb +5 -1
- data/lib/faker/default/stripe.rb +20 -4
- data/lib/faker/default/subscription.rb +45 -0
- data/lib/faker/default/superhero.rb +45 -0
- data/lib/faker/default/time.rb +37 -4
- data/lib/faker/default/twitter.rb +32 -18
- data/lib/faker/default/types.rb +27 -5
- data/lib/faker/default/vehicle.rb +17 -4
- data/lib/faker/default/world_cup.rb +11 -2
- data/lib/faker/games/dota.rb +52 -1
- data/lib/faker/games/elder_scrolls.rb +72 -0
- data/lib/faker/games/fallout.rb +37 -0
- data/lib/faker/games/game.rb +27 -0
- data/lib/faker/games/half_life.rb +27 -0
- data/lib/faker/games/heroes.rb +27 -0
- data/lib/faker/games/heroes_of_the_storm.rb +36 -0
- data/lib/faker/games/league_of_legends.rb +54 -0
- data/lib/faker/games/myst.rb +45 -0
- data/lib/faker/games/overwatch.rb +27 -0
- data/lib/faker/games/pokemon.rb +27 -0
- data/lib/faker/games/sonic_the_hedgehog.rb +27 -0
- data/lib/faker/games/super_smash_bros.rb +18 -0
- data/lib/faker/games/witcher.rb +54 -0
- data/lib/faker/games/world_of_warcraft.rb +18 -0
- data/lib/faker/games/zelda.rb +36 -0
- data/lib/faker/japanese_media/dragon_ball.rb +9 -0
- data/lib/faker/japanese_media/sword_art_online.rb +36 -0
- data/lib/faker/movies/hobbit.rb +37 -0
- data/lib/faker/movies/movie.rb +9 -0
- data/lib/faker/movies/star_wars.rb +6 -4
- data/lib/faker/music/grateful_dead.rb +18 -0
- data/lib/faker/music/phish.rb +9 -0
- data/lib/faker/music/rock_band.rb +9 -0
- data/lib/faker/tv_shows/breaking_bad.rb +18 -0
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en-CA.yml +1 -1
- data/lib/locales/en/science.yml +1 -1
- data/lib/locales/ja.yml +8 -9
- metadata +31 -14
@@ -6,10 +6,16 @@ module Faker
|
|
6
6
|
NI_CHANCE = 0.03 # NI Pop is about 3% of total UK population
|
7
7
|
|
8
8
|
class << self
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# rubocop:disable Metrics/ParameterLists
|
10
|
+
def british_driving_licence(legacy_last_name = NOT_GIVEN, legacy_initials = NOT_GIVEN, legacy_gender = NOT_GIVEN, legacy_date_of_birth = NOT_GIVEN, last_name: Faker::Name.last_name, initials: Faker::Name.initials, gender: random_gender, date_of_birth: Faker::Date.birthday(min_age: 18, max_age: 65))
|
11
|
+
# rubocop:enable Metrics/ParameterLists
|
12
|
+
warn_for_deprecated_arguments do |keywords|
|
13
|
+
keywords << :last_name if legacy_last_name != NOT_GIVEN
|
14
|
+
keywords << :initials if legacy_initials != NOT_GIVEN
|
15
|
+
keywords << :gender if legacy_gender != NOT_GIVEN
|
16
|
+
keywords << :date_of_birth if legacy_date_of_birth != NOT_GIVEN
|
17
|
+
end
|
18
|
+
|
13
19
|
[
|
14
20
|
gb_licence_padding(last_name, 5),
|
15
21
|
gb_licence_year(date_of_birth, gender),
|
@@ -5,14 +5,41 @@ module Faker
|
|
5
5
|
flexible :electrical_components
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces an active electrical component.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::ElectricalComponents.active #=> "Transistor"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.0
|
8
17
|
def active
|
9
18
|
fetch('electrical_components.active')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces a passive electrical component.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::ElectricalComponents.passive #=> "Resistor"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.0
|
12
30
|
def passive
|
13
31
|
fetch('electrical_components.passive')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces an electromechanical electrical component.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::ElectricalComponents.electromechanical #=> "Toggle Switch"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.0
|
16
43
|
def electromechanical
|
17
44
|
fetch('electrical_components.electromechanical')
|
18
45
|
end
|
data/lib/faker/default/file.rb
CHANGED
@@ -3,7 +3,15 @@
|
|
3
3
|
module Faker
|
4
4
|
class File < Base
|
5
5
|
class << self
|
6
|
-
|
6
|
+
# rubocop:disable Metrics/ParameterLists
|
7
|
+
def dir(legacy_segment_count = NOT_GIVEN, legacy_root = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, segment_count: 3, root: nil, directory_separator: '/')
|
8
|
+
# rubocop:enable Metrics/ParameterLists
|
9
|
+
warn_for_deprecated_arguments do |keywords|
|
10
|
+
keywords << :segment_count if legacy_segment_count != NOT_GIVEN
|
11
|
+
keywords << :root if legacy_root != NOT_GIVEN
|
12
|
+
keywords << :directory_separator if legacy_directory_separator != NOT_GIVEN
|
13
|
+
end
|
14
|
+
|
7
15
|
Array
|
8
16
|
.new(segment_count) { Faker::Internet.slug }
|
9
17
|
.unshift(root)
|
@@ -20,7 +28,16 @@ module Faker
|
|
20
28
|
fetch('file.mime_type')
|
21
29
|
end
|
22
30
|
|
23
|
-
|
31
|
+
# rubocop:disable Metrics/ParameterLists
|
32
|
+
def file_name(legacy_dir = NOT_GIVEN, legacy_name = NOT_GIVEN, legacy_ext = NOT_GIVEN, legacy_directory_separator = NOT_GIVEN, dir: nil, name: nil, ext: nil, directory_separator: '/')
|
33
|
+
# rubocop:enable Metrics/ParameterLists
|
34
|
+
warn_for_deprecated_arguments do |keywords|
|
35
|
+
keywords << :dir if legacy_dir != NOT_GIVEN
|
36
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
37
|
+
keywords << :ext if legacy_ext != NOT_GIVEN
|
38
|
+
keywords << :directory_separator if legacy_directory_separator != NOT_GIVEN
|
39
|
+
end
|
40
|
+
|
24
41
|
dir ||= dir(segment_count: 1)
|
25
42
|
name ||= Faker::Lorem.word.downcase
|
26
43
|
ext ||= extension
|
@@ -3,7 +3,15 @@
|
|
3
3
|
module Faker
|
4
4
|
class Fillmurray < Base
|
5
5
|
class << self
|
6
|
-
|
6
|
+
# rubocop:disable Metrics/ParameterLists
|
7
|
+
def image(legacy_grayscale = NOT_GIVEN, legacy_width = NOT_GIVEN, legacy_height = NOT_GIVEN, grayscale: false, width: 200, height: 200)
|
8
|
+
# rubocop:enable Metrics/ParameterLists
|
9
|
+
warn_for_deprecated_arguments do |keywords|
|
10
|
+
keywords << :grayscale if legacy_grayscale != NOT_GIVEN
|
11
|
+
keywords << :width if legacy_width != NOT_GIVEN
|
12
|
+
keywords << :height if legacy_height != NOT_GIVEN
|
13
|
+
end
|
14
|
+
|
7
15
|
raise ArgumentError, 'Width should be a number' unless width.to_s =~ /^\d+$/
|
8
16
|
raise ArgumentError, 'Height should be a number' unless height.to_s =~ /^\d+$/
|
9
17
|
raise ArgumentError, 'Grayscale should be a boolean' unless [true, false].include?(grayscale)
|
@@ -26,7 +26,11 @@ module Faker
|
|
26
26
|
template.gsub('L', luhn_digit.to_s)
|
27
27
|
end
|
28
28
|
|
29
|
-
def vat_number(country: 'BR')
|
29
|
+
def vat_number(legacy_country = NOT_GIVEN, country: 'BR')
|
30
|
+
warn_for_deprecated_arguments do |keywords|
|
31
|
+
keywords << :country if legacy_country != NOT_GIVEN
|
32
|
+
end
|
33
|
+
|
30
34
|
numerify(fetch("finance.vat_number.#{country}"))
|
31
35
|
rescue I18n::MissingTranslationData
|
32
36
|
raise ArgumentError, "Could not find vat number for #{country}"
|
data/lib/faker/default/gender.rb
CHANGED
@@ -3,10 +3,28 @@
|
|
3
3
|
module Faker
|
4
4
|
class Gender < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces the name of a gender identity.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::Gender.type #=> "Non-binary"
|
13
|
+
#
|
14
|
+
# @faker.version 1.9.0
|
6
15
|
def type
|
7
16
|
fetch('gender.types')
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces either 'Male' or 'Female'.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::Gender.binary_type #=> "Female"
|
26
|
+
#
|
27
|
+
# @faker.version 1.9.0
|
10
28
|
def binary_type
|
11
29
|
fetch('gender.binary_types')
|
12
30
|
end
|
@@ -3,10 +3,28 @@
|
|
3
3
|
module Faker
|
4
4
|
class GreekPhilosophers < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces the name of a Greek philosopher.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::GreekPhilosophers.name #=> "Socrates"
|
13
|
+
#
|
14
|
+
# @faker.version 1.9.0
|
6
15
|
def name
|
7
16
|
fetch('greek_philosophers.names')
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces a quote from a Greek philosopher.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::GreekPhilosophers.quote #=> "Only the educated are free."
|
26
|
+
#
|
27
|
+
# @faker.version 1.9.0
|
10
28
|
def quote
|
11
29
|
fetch('greek_philosophers.quotes')
|
12
30
|
end
|
data/lib/faker/default/hacker.rb
CHANGED
@@ -1,35 +1,93 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Port of http://shinytoylabs.com/jargon/
|
4
3
|
module Faker
|
4
|
+
# Port of http://shinytoylabs.com/jargon/
|
5
|
+
# Are you having trouble writing tech-savvy dialogue for your latest screenplay?
|
6
|
+
# Worry not! Hollywood-grade technical talk is ready to fill out any form where you need to look smart.
|
5
7
|
class Hacker < Base
|
6
8
|
flexible :hacker
|
7
9
|
|
8
10
|
class << self
|
11
|
+
##
|
12
|
+
# Produces something smart.
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
#
|
16
|
+
# @example
|
17
|
+
# Faker::Hacker.say_something_smart
|
18
|
+
# #=> "Try to compress the SQL interface, maybe it will program the back-end hard drive!"
|
19
|
+
#
|
20
|
+
# @faker.version 1.4.0
|
9
21
|
def say_something_smart
|
10
22
|
sample(phrases)
|
11
23
|
end
|
12
24
|
|
25
|
+
##
|
26
|
+
# Short technical abbreviations.
|
27
|
+
#
|
28
|
+
# @return [String]
|
29
|
+
#
|
30
|
+
# @example
|
31
|
+
# Faker::Hacker.abbreviation #=> "RAM"
|
32
|
+
#
|
33
|
+
# @faker.version 1.4.0
|
13
34
|
def abbreviation
|
14
35
|
fetch('hacker.abbreviation')
|
15
36
|
end
|
16
37
|
|
38
|
+
##
|
39
|
+
# Hacker-centric adjectives.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# Faker::Hacker.adjective #=> "open-source"
|
45
|
+
#
|
46
|
+
# @faker.version 1.4.0
|
17
47
|
def adjective
|
18
48
|
fetch('hacker.adjective')
|
19
49
|
end
|
20
50
|
|
51
|
+
##
|
52
|
+
# Only the best hacker-related nouns.
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Faker::Hacker.noun #=> "bandwidth"
|
58
|
+
#
|
59
|
+
# @faker.version 1.4.0
|
21
60
|
def noun
|
22
61
|
fetch('hacker.noun')
|
23
62
|
end
|
24
63
|
|
64
|
+
##
|
65
|
+
# Actions that hackers take.
|
66
|
+
#
|
67
|
+
# @return [String]
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Faker::Hacker.verb #=> "bypass"
|
71
|
+
#
|
72
|
+
# @faker.version 1.4.0
|
25
73
|
def verb
|
26
74
|
fetch('hacker.verb')
|
27
75
|
end
|
28
76
|
|
77
|
+
##
|
78
|
+
# Produces a verb that ends with '-ing'.
|
79
|
+
#
|
80
|
+
# @return [String]
|
81
|
+
#
|
82
|
+
# @example
|
83
|
+
# Faker::Hacker.ingverb #=> "synthesizing"
|
84
|
+
#
|
85
|
+
# @faker.version 1.4.0
|
29
86
|
def ingverb
|
30
87
|
fetch('hacker.ingverb')
|
31
88
|
end
|
32
89
|
|
90
|
+
# @private
|
33
91
|
def phrases
|
34
92
|
["If we #{verb} the #{noun}, we can get to the #{abbreviation} #{noun} through the #{adjective} #{abbreviation} #{noun}!",
|
35
93
|
"We need to #{verb} the #{adjective} #{abbreviation} #{noun}!",
|
@@ -8,7 +8,15 @@ module Faker
|
|
8
8
|
random_word =~ /\s/ ? word : random_word
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
# rubocop:disable Metrics/ParameterLists
|
12
|
+
def words(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_spaces_allowed = NOT_GIVEN, number: 3, supplemental: false, spaces_allowed: false)
|
13
|
+
# rubocop:enable Metrics/ParameterLists
|
14
|
+
warn_for_deprecated_arguments do |keywords|
|
15
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
16
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
17
|
+
keywords << :spaces_allowed if legacy_spaces_allowed != NOT_GIVEN
|
18
|
+
end
|
19
|
+
|
12
20
|
resolved_num = resolve(number)
|
13
21
|
word_list = (
|
14
22
|
translate('faker.hipster.words') +
|
@@ -22,11 +30,24 @@ module Faker
|
|
22
30
|
words.each_with_index { |w, i| words[i] = word if w =~ /\s/ }
|
23
31
|
end
|
24
32
|
|
25
|
-
|
33
|
+
# rubocop:disable Metrics/ParameterLists
|
34
|
+
def sentence(legacy_word_count = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_random_words_to_add = NOT_GIVEN, word_count: 4, supplemental: false, random_words_to_add: 6)
|
35
|
+
# rubocop:enable Metrics/ParameterLists
|
36
|
+
warn_for_deprecated_arguments do |keywords|
|
37
|
+
keywords << :word_count if legacy_word_count != NOT_GIVEN
|
38
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
39
|
+
keywords << :random_words_to_add if legacy_random_words_to_add != NOT_GIVEN
|
40
|
+
end
|
41
|
+
|
26
42
|
words(number: word_count + rand(random_words_to_add.to_i).to_i, supplemental: supplemental, spaces_allowed: true).join(' ').capitalize + '.'
|
27
43
|
end
|
28
44
|
|
29
|
-
def sentences(number: 3, supplemental: false)
|
45
|
+
def sentences(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
46
|
+
warn_for_deprecated_arguments do |keywords|
|
47
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
48
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
49
|
+
end
|
50
|
+
|
30
51
|
[].tap do |sentences|
|
31
52
|
1.upto(resolve(number)) do
|
32
53
|
sentences << sentence(word_count: 3, supplemental: supplemental)
|
@@ -34,11 +55,24 @@ module Faker
|
|
34
55
|
end
|
35
56
|
end
|
36
57
|
|
37
|
-
|
58
|
+
# rubocop:disable Metrics/ParameterLists
|
59
|
+
def paragraph(legacy_sentence_count = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, legacy_random_sentences_to_add = NOT_GIVEN, sentence_count: 3, supplemental: false, random_sentences_to_add: 3)
|
60
|
+
# rubocop:enable Metrics/ParameterLists
|
61
|
+
warn_for_deprecated_arguments do |keywords|
|
62
|
+
keywords << :sentence_count if legacy_sentence_count != NOT_GIVEN
|
63
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
64
|
+
keywords << :random_sentences_to_add if legacy_random_sentences_to_add != NOT_GIVEN
|
65
|
+
end
|
66
|
+
|
38
67
|
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i, supplemental: supplemental).join(' ')
|
39
68
|
end
|
40
69
|
|
41
|
-
def paragraphs(number: 3, supplemental: false)
|
70
|
+
def paragraphs(legacy_number = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, number: 3, supplemental: false)
|
71
|
+
warn_for_deprecated_arguments do |keywords|
|
72
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
73
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
74
|
+
end
|
75
|
+
|
42
76
|
[].tap do |paragraphs|
|
43
77
|
1.upto(resolve(number)) do
|
44
78
|
paragraphs << paragraph(sentence_count: 3, supplemental: supplemental)
|
@@ -46,7 +80,12 @@ module Faker
|
|
46
80
|
end
|
47
81
|
end
|
48
82
|
|
49
|
-
def paragraph_by_chars(characters: 256, supplemental: false)
|
83
|
+
def paragraph_by_chars(legacy_characters = NOT_GIVEN, legacy_supplemental = NOT_GIVEN, characters: 256, supplemental: false)
|
84
|
+
warn_for_deprecated_arguments do |keywords|
|
85
|
+
keywords << :characters if legacy_characters != NOT_GIVEN
|
86
|
+
keywords << :supplemental if legacy_supplemental != NOT_GIVEN
|
87
|
+
end
|
88
|
+
|
50
89
|
paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
|
51
90
|
|
52
91
|
paragraph += ' ' + paragraph(sentence_count: 3, supplemental: supplemental) while paragraph.length < characters
|
data/lib/faker/default/house.rb
CHANGED
@@ -3,10 +3,28 @@
|
|
3
3
|
module Faker
|
4
4
|
class House < Base
|
5
5
|
class << self
|
6
|
+
##
|
7
|
+
# Produces the name of a piece of furniture.
|
8
|
+
#
|
9
|
+
# @return [String]
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# Faker::House.furniture #=> "chair"
|
13
|
+
#
|
14
|
+
# @faker.version 1.9.2
|
6
15
|
def furniture
|
7
16
|
fetch('house.furniture')
|
8
17
|
end
|
9
18
|
|
19
|
+
##
|
20
|
+
# Produces the name of a room in a house.
|
21
|
+
#
|
22
|
+
# @return [String]
|
23
|
+
#
|
24
|
+
# @example
|
25
|
+
# Faker::House.room #=> "kitchen"
|
26
|
+
#
|
27
|
+
# @faker.version 1.9.2
|
10
28
|
def room
|
11
29
|
fetch('house.rooms')
|
12
30
|
end
|
@@ -12,7 +12,7 @@ module Faker
|
|
12
12
|
].freeze
|
13
13
|
ZA_RACE_DIGIT = '8'
|
14
14
|
ZA_CITIZENSHIP_DIGITS = %w[0 1].freeze
|
15
|
-
BRAZILIAN_ID_FORMAT = /(\d{1,2})(\d{3})(\d{3})([\dX])
|
15
|
+
BRAZILIAN_ID_FORMAT = /(\d{1,2})(\d{3})(\d{3})([\dX])/.freeze
|
16
16
|
BRAZILIAN_ID_FROM = 10_000_000
|
17
17
|
BRAZILIAN_ID_TO = 99_999_999
|
18
18
|
|
@@ -78,7 +78,11 @@ module Faker
|
|
78
78
|
[id_number, south_african_id_checksum_digit(id_number)].join
|
79
79
|
end
|
80
80
|
|
81
|
-
def brazilian_citizen_number(formatted: false)
|
81
|
+
def brazilian_citizen_number(legacy_formatted = NOT_GIVEN, formatted: false)
|
82
|
+
warn_for_deprecated_arguments do |keywords|
|
83
|
+
keywords << :formatted if legacy_formatted != NOT_GIVEN
|
84
|
+
end
|
85
|
+
|
82
86
|
digits = Faker::Number.leading_zero_number(digits: 9) until digits&.match(/(\d)((?!\1)\d)+/)
|
83
87
|
first_digit = brazilian_citizen_number_checksum_digit(digits)
|
84
88
|
second_digit = brazilian_citizen_number_checksum_digit(digits + first_digit)
|
@@ -88,7 +92,11 @@ module Faker
|
|
88
92
|
|
89
93
|
alias brazilian_cpf brazilian_citizen_number
|
90
94
|
|
91
|
-
def brazilian_id(formatted: false)
|
95
|
+
def brazilian_id(legacy_formatted = NOT_GIVEN, formatted: false)
|
96
|
+
warn_for_deprecated_arguments do |keywords|
|
97
|
+
keywords << :formatted if legacy_formatted != NOT_GIVEN
|
98
|
+
end
|
99
|
+
|
92
100
|
digits = Faker::Number.between(to: BRAZILIAN_ID_FROM, from: BRAZILIAN_ID_TO).to_s
|
93
101
|
check_digit = brazilian_id_checksum_digit(digits)
|
94
102
|
number = [digits, check_digit].join
|
@@ -5,18 +5,54 @@ module Faker
|
|
5
5
|
flexible :industry_segments
|
6
6
|
|
7
7
|
class << self
|
8
|
+
##
|
9
|
+
# Produces the name of an industry.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# Faker::IndustrySegments.industry #=> "Basic Materials"
|
15
|
+
#
|
16
|
+
# @faker.version 1.9.2
|
8
17
|
def industry
|
9
18
|
fetch('industry_segments.industry')
|
10
19
|
end
|
11
20
|
|
21
|
+
##
|
22
|
+
# Produces the name of a super-sector of an industry.
|
23
|
+
#
|
24
|
+
# @return [String]
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# Faker::IndustrySegments.super_sector #=> "Basic Resources"
|
28
|
+
#
|
29
|
+
# @faker.version 1.9.2
|
12
30
|
def super_sector
|
13
31
|
fetch('industry_segments.super_sector')
|
14
32
|
end
|
15
33
|
|
34
|
+
##
|
35
|
+
# Produces the name of a sector of an industry.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
# @example
|
40
|
+
# Faker::IndustrySegments.sector #=> "Industrial Metals & Mining"
|
41
|
+
#
|
42
|
+
# @faker.version 1.9.2
|
16
43
|
def sector
|
17
44
|
fetch('industry_segments.sector')
|
18
45
|
end
|
19
46
|
|
47
|
+
##
|
48
|
+
# Produces the name of a subsector of an industry.
|
49
|
+
#
|
50
|
+
# @return [String]
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# Faker::IndustrySegments.industry #=> "Basic Materials"
|
54
|
+
#
|
55
|
+
# @faker.version 1.9.2
|
20
56
|
def sub_sector
|
21
57
|
fetch('industry_segments.sub_sector')
|
22
58
|
end
|