faker 2.15.1 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +848 -34
- data/README.md +225 -103
- data/lib/faker/blockchain/aeternity.rb +1 -1
- data/lib/faker/blockchain/bitcoin.rb +2 -2
- data/lib/faker/blockchain/ethereum.rb +1 -1
- data/lib/faker/blockchain/tezos.rb +31 -3
- data/lib/faker/books/dune.rb +2 -10
- data/lib/faker/books/lovecraft.rb +9 -41
- data/lib/faker/books/the_kingkiller_chronicle.rb +61 -0
- data/lib/faker/creature/bird.rb +203 -0
- data/lib/faker/default/address.rb +7 -27
- data/lib/faker/default/alphanumeric.rb +2 -8
- data/lib/faker/default/app.rb +1 -10
- data/lib/faker/default/avatar.rb +1 -12
- data/lib/faker/default/bank.rb +25 -17
- data/lib/faker/default/barcode.rb +33 -22
- data/lib/faker/default/boolean.rb +1 -4
- data/lib/faker/default/cannabis.rb +10 -0
- data/lib/faker/default/chile_rut.rb +25 -25
- data/lib/faker/default/chuck_norris.rb +1 -0
- data/lib/faker/default/code.rb +71 -42
- data/lib/faker/default/color.rb +77 -6
- data/lib/faker/default/commerce.rb +31 -17
- data/lib/faker/default/company.rb +137 -22
- data/lib/faker/default/crypto.rb +26 -4
- data/lib/faker/default/crypto_coin.rb +3 -15
- data/lib/faker/default/date.rb +65 -42
- data/lib/faker/default/demographic.rb +1 -5
- data/lib/faker/default/driving_licence.rb +20 -18
- data/lib/faker/default/drone.rb +1 -1
- data/lib/faker/default/educator.rb +13 -0
- data/lib/faker/default/emotion.rb +33 -0
- data/lib/faker/default/file.rb +5 -22
- data/lib/faker/default/finance.rb +30 -7
- data/lib/faker/default/food.rb +27 -1
- data/lib/faker/default/hipster.rb +8 -48
- data/lib/faker/default/hobby.rb +22 -0
- data/lib/faker/default/html.rb +230 -0
- data/lib/faker/default/id_number.rb +175 -27
- data/lib/faker/default/internet.rb +333 -114
- data/lib/faker/default/invoice.rb +4 -17
- data/lib/faker/default/json.rb +4 -21
- data/lib/faker/default/lorem.rb +175 -73
- data/lib/faker/default/lorem_flickr.rb +4 -37
- data/lib/faker/default/markdown.rb +10 -13
- data/lib/faker/default/marketing.rb +1 -1
- data/lib/faker/default/measurement.rb +16 -48
- data/lib/faker/default/name.rb +1 -5
- data/lib/faker/default/nation.rb +0 -3
- data/lib/faker/default/{nhs.rb → national_health_service.rb} +9 -8
- data/lib/faker/default/number.rb +33 -61
- data/lib/faker/default/omniauth.rb +55 -52
- data/lib/faker/default/phone_number.rb +36 -21
- data/lib/faker/default/placeholdit.rb +10 -20
- data/lib/faker/default/relationship.rb +1 -5
- data/lib/faker/default/religion.rb +6 -0
- data/lib/faker/default/science.rb +108 -0
- data/lib/faker/default/source.rb +3 -16
- data/lib/faker/default/south_africa.rb +3 -3
- data/lib/faker/default/string.rb +1 -7
- data/lib/faker/default/stripe.rb +4 -20
- data/lib/faker/default/tea.rb +41 -0
- data/lib/faker/{music/show.rb → default/theater.rb} +11 -8
- data/lib/faker/default/time.rb +4 -34
- data/lib/faker/default/twitter.rb +7 -23
- data/lib/faker/default/types.rb +12 -34
- data/lib/faker/default/vehicle.rb +44 -54
- data/lib/faker/default/vulnerability_identifier.rb +23 -0
- data/lib/faker/default/world_cup.rb +2 -11
- data/lib/faker/games/clash_of_clans.rb +1 -1
- data/lib/faker/games/dnd.rb +49 -7
- data/lib/faker/games/dota.rb +14 -5
- data/lib/faker/games/final_fantasy_xiv.rb +73 -0
- data/lib/faker/games/minecraft.rb +1 -1
- data/lib/faker/games/myst.rb +1 -1
- data/lib/faker/games/tarkov.rb +205 -0
- data/lib/faker/games/touhou.rb +75 -0
- data/lib/faker/games/witcher.rb +39 -0
- data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
- data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +51 -0
- data/lib/faker/japanese_media/kamen_rider.rb +102 -0
- data/lib/faker/japanese_media/one_piece.rb +1 -1
- data/lib/faker/locations/australia.rb +52 -0
- data/lib/faker/movies/avatar.rb +49 -0
- data/lib/faker/movies/hackers.rb +48 -0
- data/lib/faker/movies/star_wars.rb +73 -5
- data/lib/faker/movies/{room.rb → the_room.rb} +4 -4
- data/lib/faker/movies/tron.rb +161 -0
- data/lib/faker/music/hiphop.rb +3 -3
- data/lib/faker/music/music.rb +12 -0
- data/lib/faker/music/rock_band.rb +12 -0
- data/lib/faker/music/smashing_pumpkins.rb +64 -0
- data/lib/faker/quotes/quote.rb +13 -0
- data/lib/faker/quotes/rajnikanth.rb +1 -0
- data/lib/faker/quotes/shakespeare.rb +34 -0
- data/lib/faker/religion/bible.rb +50 -0
- data/lib/faker/sports/chess.rb +90 -0
- data/lib/faker/sports/mountaineering.rb +22 -0
- data/lib/faker/sports/sport.rb +116 -0
- data/lib/faker/travel/airport.rb +43 -0
- data/lib/faker/travel/train_station.rb +54 -0
- data/lib/faker/tv_shows/archer.rb +51 -0
- data/lib/faker/tv_shows/big_bang_theory.rb +1 -1
- data/lib/faker/tv_shows/brooklyn_nine_nine.rb +38 -0
- data/lib/faker/tv_shows/michael_scott.rb +0 -3
- data/lib/faker/tv_shows/south_park.rb +15 -0
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/tv_shows/suits.rb +1 -1
- data/lib/faker/tv_shows/supernatural.rb +48 -0
- data/lib/faker/tv_shows/the_office.rb +37 -0
- data/lib/faker/version.rb +2 -2
- data/lib/faker.rb +26 -67
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/deprecator.rb +53 -0
- data/lib/helpers/positional_generator.rb +480 -0
- data/lib/helpers/unique_generator.rb +13 -14
- data/lib/locales/README.md +18 -2
- data/lib/locales/ar.yml +6 -1
- data/lib/locales/bg.yml +1 -2
- data/lib/locales/da-DK.yml +529 -35
- data/lib/locales/de-AT.yml +3487 -27
- data/lib/locales/de-CH.yml +4328 -12
- data/lib/locales/de.yml +7185 -99
- data/lib/locales/ee.yml +0 -1
- data/lib/locales/en/address.yml +1826 -562
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/animal.yml +1 -1
- data/lib/locales/en/archer.yml +75 -0
- data/lib/locales/en/australia.yml +108 -0
- data/lib/locales/en/avatar.yml +31 -0
- data/lib/locales/en/bank.yml +1 -1
- data/lib/locales/en/bible.yml +90 -0
- data/lib/locales/en/bird.yml +1281 -0
- data/lib/locales/en/book.yml +487 -3
- data/lib/locales/en/brooklyn_nine_nine.yml +35 -0
- data/lib/locales/en/cat.yml +1 -1
- data/lib/locales/en/chess.yml +103 -0
- data/lib/locales/en/coffee.yml +1 -1
- data/lib/locales/en/commerce.yml +17 -0
- data/lib/locales/en/community.yml +17 -17
- data/lib/locales/en/company.yml +1 -0
- data/lib/locales/en/computer.yml +23 -4
- data/lib/locales/en/cowboy_bebop.yml +163 -0
- data/lib/locales/en/device.yml +112 -4
- data/lib/locales/en/dnd.yml +186 -1
- data/lib/locales/en/dog.yml +262 -7
- data/lib/locales/en/dota.yml +173 -0
- data/lib/locales/en/dune.yml +266 -397
- data/lib/locales/en/educator.yml +6 -0
- data/lib/locales/en/emotion.yml +480 -0
- data/lib/locales/en/file.yml +9 -1
- data/lib/locales/en/final_fantasy_xiv.yml +754 -0
- data/lib/locales/en/finance.yml +27 -4
- data/lib/locales/en/food.yml +1067 -10
- data/lib/locales/en/football.yml +3 -3
- data/lib/locales/en/fullmetal_alchemist_brotherhood.yml +78 -0
- data/lib/locales/en/game.yml +11 -0
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/harry_potter.yml +1 -1
- data/lib/locales/en/heroes.yml +2 -2
- data/lib/locales/en/hobby.yml +171 -0
- data/lib/locales/en/horse.yml +2 -2
- data/lib/locales/en/id_number.yml +1 -1
- data/lib/locales/en/internet.yml +136 -3
- data/lib/locales/en/kamen_rider.yml +452 -0
- data/lib/locales/en/kpop.yml +7 -7
- data/lib/locales/en/lebowski.yml +1 -1
- data/lib/locales/en/lovecraft.yml +76 -6
- data/lib/locales/en/minecraft.yml +4 -4
- data/lib/locales/en/mitch_hedberg.yml +46 -0
- data/lib/locales/en/mountain.yml +14 -1
- data/lib/locales/en/mountaineering.yml +14 -0
- data/lib/locales/en/movie.yml +2 -1
- data/lib/locales/en/music.yml +152 -142
- data/lib/locales/en/naruto.yml +2 -3
- data/lib/locales/en/one_piece.yml +1 -1
- data/lib/locales/en/opera.yml +2 -2
- data/lib/locales/en/overwatch.yml +5 -7
- data/lib/locales/en/phone_number.yml +78 -3
- data/lib/locales/en/rock_band.yml +1 -0
- data/lib/locales/en/science.yml +481 -3
- data/lib/locales/en/shakespeare.yml +21 -24
- data/lib/locales/en/smashing_pumpkins.yml +382 -0
- data/lib/locales/en/source.yml +5 -0
- data/lib/locales/en/south_park.yml +360 -2
- data/lib/locales/en/space.yml +1 -1
- data/lib/locales/en/spongebob.yml +489 -0
- data/lib/locales/en/sport.yml +130 -0
- data/lib/locales/en/star_wars.yml +1 -1
- data/lib/locales/en/stranger_thing.yml +1 -1
- data/lib/locales/en/super_smash_bros.yml +7 -2
- data/lib/locales/en/supernatural.yml +141 -0
- data/lib/locales/en/tarkov.yml +593 -0
- data/lib/locales/en/tea.yml +172 -0
- data/lib/locales/en/the_kingkiller_chronicle.yml +56 -0
- data/lib/locales/en/the_office.yml +86 -0
- data/lib/locales/en/{room.yml → the_room.yml} +1 -1
- data/lib/locales/en/{show.yml → theater.yml} +1 -1
- data/lib/locales/en/touhou.yml +839 -0
- data/lib/locales/en/train_station.yml +280 -0
- data/lib/locales/en/tron.yml +227 -0
- data/lib/locales/en/vehicle.yml +2809 -75
- data/lib/locales/en/witcher.yml +37 -0
- data/lib/locales/en-AU.yml +718 -47
- data/lib/locales/en-CA.yml +373 -18
- data/lib/locales/en-GB.yml +116 -8
- data/lib/locales/en-IND.yml +1259 -17
- data/lib/locales/en-KE.yml +212 -0
- data/lib/locales/en-MS.yml +364 -17
- data/lib/locales/en-NEP.yml +212 -38
- data/lib/locales/en-NG.yml +1 -0
- data/lib/locales/en-NZ.yml +1153 -123
- data/lib/locales/en-PAK.yml +369 -10
- data/lib/locales/en-SG.yml +581 -16
- data/lib/locales/en-UG.yml +1 -0
- data/lib/locales/en-US.yml +6914 -74
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en-au-ocker.yml +266 -22
- data/lib/locales/es-AR.yml +4570 -0
- data/lib/locales/es-MX.yml +1 -2
- data/lib/locales/es.yml +2 -3
- data/lib/locales/fi-FI.yml +3 -1
- data/lib/locales/fr/address.yml +20 -0
- data/lib/locales/fr/adjective.yml +266 -0
- data/lib/locales/fr/ancient.yml +141 -0
- data/lib/locales/fr/animal.yml +5 -0
- data/lib/locales/fr/appliance.yml +4 -0
- data/lib/locales/fr/book.yml +7 -0
- data/lib/locales/fr/color.yml +4 -0
- data/lib/locales/fr/company.yml +17 -0
- data/lib/locales/fr/compass.yml +23 -0
- data/lib/locales/fr/demographic.yml +4 -0
- data/lib/locales/fr/gender.yml +6 -0
- data/lib/locales/fr/internet.yml +4 -0
- data/lib/locales/fr/lorem.yml +5 -0
- data/lib/locales/fr/measurement.yml +7 -0
- data/lib/locales/fr/name.yml +22 -0
- data/lib/locales/fr/phone_number.yml +7 -0
- data/lib/locales/fr/pokemon.yml +7 -0
- data/lib/locales/fr-CA.yml +2733 -44
- data/lib/locales/fr-CH.yml +1 -2
- data/lib/locales/fr.yml +2 -118
- data/lib/locales/hy.yml +3624 -119
- data/lib/locales/id.yml +839 -12
- data/lib/locales/it.yml +1304 -32
- data/lib/locales/ja/README.md +13 -0
- data/lib/locales/ja/address.yml +120539 -0
- data/lib/locales/ja/adjective.yml +148 -0
- data/lib/locales/ja/ancient.yml +4 -0
- data/lib/locales/ja/animal.yml +5 -0
- data/lib/locales/ja/bank.yml +4 -0
- data/lib/locales/ja/book.yml +7 -0
- data/lib/locales/ja/cat.yml +5 -0
- data/lib/locales/ja/coffee.yml +4 -0
- data/lib/locales/ja/color.yml +4 -0
- data/lib/locales/ja/commerce.yml +11 -0
- data/lib/locales/ja/company.yml +8 -0
- data/lib/locales/ja/dog.yml +6 -0
- data/lib/locales/ja/emotion.yml +51 -0
- data/lib/locales/ja/food.yml +4 -0
- data/lib/locales/ja/football.yml +115 -0
- data/lib/locales/ja/gender.yml +4 -0
- data/lib/locales/ja/lorem.yml +9 -0
- data/lib/locales/ja/name.yml +13 -0
- data/lib/locales/ja/naruto.yml +230 -0
- data/lib/locales/ja/overwatch.yml +5 -0
- data/lib/locales/ja/phone_number.yml +7 -0
- data/lib/locales/ja/pokemon.yml +7 -0
- data/lib/locales/ja/relationship.yml +10 -0
- data/lib/locales/ja/restaurant.yml +11 -0
- data/lib/locales/ja/space.yml +5 -0
- data/lib/locales/ja/sport.yml +130 -0
- data/lib/locales/ja/studio_ghibli.yml +112 -0
- data/lib/locales/ja/subscription.yml +8 -0
- data/lib/locales/ja/super_mario.yml +9 -0
- data/lib/locales/ja/super_smash_bros.yml +8 -0
- data/lib/locales/ja/touhou.yml +466 -0
- data/lib/locales/ja/university.yml +9 -0
- data/lib/locales/ja/zelda.yml +5 -0
- data/lib/locales/ko.yml +1361 -20
- data/lib/locales/lt.yml +315 -0
- data/lib/locales/lv.yml +1 -2
- data/lib/locales/mi-NZ.yml +283 -0
- data/lib/locales/nb-NO.yml +518 -29
- data/lib/locales/nl.yml +1 -1
- data/lib/locales/pl.yml +1 -2
- data/lib/locales/pt-BR.yml +8157 -660
- data/lib/locales/pt.yml +844 -45
- data/lib/locales/ru.yml +1355 -32
- data/lib/locales/sk.yml +4410 -43
- data/lib/locales/sv.yml +100 -0
- data/lib/locales/th.yml +76 -76
- data/lib/locales/tr.yml +1 -2
- data/lib/locales/uk.yml +1808 -44
- data/lib/locales/vi.yml +1 -0
- data/lib/locales/zh-CN/bank.yml +17 -0
- data/lib/locales/zh-CN.yml +1 -0
- data/lib/locales/zh-TW.yml +1 -0
- metadata +134 -133
- data/History.md +0 -176
- data/lib/faker/default/fillmurray.rb +0 -45
- data/lib/faker/default/lorem_pixel.rb +0 -69
- data/lib/locales/ja.yml +0 -105
- /data/lib/faker/default/{faker_adjective.rb → adjective.rb} +0 -0
data/lib/faker/default/json.rb
CHANGED
|
@@ -20,12 +20,7 @@ module Faker
|
|
|
20
20
|
# something to eat - it's all been wrong."}
|
|
21
21
|
#
|
|
22
22
|
# @faker.version 1.9.2
|
|
23
|
-
def shallow_json(
|
|
24
|
-
warn_for_deprecated_arguments do |keywords|
|
|
25
|
-
keywords << :width if legacy_width != NOT_GIVEN
|
|
26
|
-
keywords << :options if legacy_options != NOT_GIVEN
|
|
27
|
-
end
|
|
28
|
-
|
|
23
|
+
def shallow_json(width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
|
|
29
24
|
options[:key] = "Faker::#{options[:key]}"
|
|
30
25
|
options[:value] = "Faker::#{options[:value]}"
|
|
31
26
|
|
|
@@ -71,24 +66,12 @@ module Faker
|
|
|
71
66
|
# {"Rick":"Wiza","Bonita":"Bayer","Gardner":"Auer","Felicity":"Abbott"}}}
|
|
72
67
|
#
|
|
73
68
|
# @faker.version 1.9.2
|
|
74
|
-
|
|
75
|
-
def add_depth_to_json(legacy_json = NOT_GIVEN, legacy_width = NOT_GIVEN, legacy_options = NOT_GIVEN, json: shallow_json, width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
|
|
76
|
-
# rubocop:enable Metrics/ParameterLists
|
|
77
|
-
warn_for_deprecated_arguments do |keywords|
|
|
78
|
-
keywords << :json if legacy_json != NOT_GIVEN
|
|
79
|
-
end
|
|
80
|
-
warn_for_deprecated_arguments do |keywords|
|
|
81
|
-
keywords << :width if legacy_width != NOT_GIVEN
|
|
82
|
-
end
|
|
83
|
-
warn_for_deprecated_arguments do |keywords|
|
|
84
|
-
keywords << :options if legacy_options != NOT_GIVEN
|
|
85
|
-
end
|
|
86
|
-
|
|
69
|
+
def add_depth_to_json(json: shallow_json, width: 3, options: { key: 'Name.first_name', value: 'Name.first_name' })
|
|
87
70
|
options[:key] = "Faker::#{options[:key]}"
|
|
88
71
|
options[:value] = "Faker::#{options[:value]}"
|
|
89
72
|
|
|
90
73
|
hash = JSON.parse(json)
|
|
91
|
-
hash.
|
|
74
|
+
hash.each_key do |key|
|
|
92
75
|
add_hash_to_bottom(hash, [key], width, options)
|
|
93
76
|
end
|
|
94
77
|
JSON.generate(hash)
|
|
@@ -110,7 +93,7 @@ module Faker
|
|
|
110
93
|
def add_hash_to_bottom(hash, key_array, width, options)
|
|
111
94
|
key_string = build_keys_from_array(key_array)
|
|
112
95
|
if eval("hash#{key_string}").is_a?(::Hash)
|
|
113
|
-
eval("hash#{key_string}").
|
|
96
|
+
eval("hash#{key_string}").each_key do |key|
|
|
114
97
|
key_array << key
|
|
115
98
|
add_hash_to_bottom(hash, key_array, width, options)
|
|
116
99
|
end
|
data/lib/faker/default/lorem.rb
CHANGED
|
@@ -4,25 +4,59 @@ module Faker
|
|
|
4
4
|
# Based on Perl's Text::Lorem
|
|
5
5
|
class Lorem < Base
|
|
6
6
|
class << self
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
##
|
|
8
|
+
# Returs the random word
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Lorem.word #=> "soluto"
|
|
13
|
+
# Faker::Lorem.word(exclude_words: 'error') #=> "nisi"
|
|
14
|
+
# Faker::Lorem.word(exclude_words: 'id, error') #=> "et"
|
|
15
|
+
# Faker::Lorem.word(exclude_words: ['id', 'error']) #=> "consequatur"
|
|
16
|
+
#
|
|
17
|
+
# @faker.version 2.1.3
|
|
18
|
+
def word(exclude_words: nil)
|
|
19
|
+
words(number: 1, exclude_words: exclude_words).first
|
|
9
20
|
end
|
|
10
21
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
##
|
|
23
|
+
# Generates random 3 words
|
|
24
|
+
#
|
|
25
|
+
# @param number [Integer] Number of words to be generated
|
|
26
|
+
# @param supplemental [Boolean] Whether to attach supplemental words at the end, default is false
|
|
27
|
+
#
|
|
28
|
+
# @return [Array] Array for words
|
|
29
|
+
#
|
|
30
|
+
# @example
|
|
31
|
+
# Faker::Lorem.words #=> ["hic", "quia", "nihil"]
|
|
32
|
+
# Faker::Lorem.words(number: 4) #=> ["est", "temporibus", "et", "quaerat"]
|
|
33
|
+
# Faker::Lorem.words(number: 4, supplemental: true) #=> ["nisi", "sit", "allatus", "consequatur"]
|
|
34
|
+
# Faker::Lorem.words(number: 4, supplemental: true, exclude_words: 'sit') #=> ["nisi", "allatus", "consequatur", "aut"]
|
|
35
|
+
#
|
|
36
|
+
# @faker.version 2.1.3
|
|
37
|
+
def words(number: 3, supplemental: false, exclude_words: nil)
|
|
17
38
|
resolved_num = resolve(number)
|
|
18
39
|
word_list = (
|
|
19
40
|
translate('faker.lorem.words') +
|
|
20
41
|
(supplemental ? translate('faker.lorem.supplemental') : [])
|
|
21
42
|
)
|
|
43
|
+
if exclude_words
|
|
44
|
+
exclude_words = exclude_words.split(', ') if exclude_words.instance_of?(::String)
|
|
45
|
+
word_list -= exclude_words
|
|
46
|
+
end
|
|
22
47
|
word_list *= ((resolved_num / word_list.length) + 1)
|
|
23
|
-
|
|
48
|
+
sample(word_list, resolved_num)
|
|
24
49
|
end
|
|
25
50
|
|
|
51
|
+
##
|
|
52
|
+
# Generates single character
|
|
53
|
+
#
|
|
54
|
+
# @return [String]
|
|
55
|
+
#
|
|
56
|
+
# @example
|
|
57
|
+
# Faker::Lorem.character #=> "e"
|
|
58
|
+
#
|
|
59
|
+
# @faker.version 2.1.3
|
|
26
60
|
def character
|
|
27
61
|
sample(Types::CHARACTERS)
|
|
28
62
|
end
|
|
@@ -43,68 +77,119 @@ module Faker
|
|
|
43
77
|
# Faker::Lorem.characters(number: 10, min_alpha: 4, min_numeric: 1) #=> "ang9cbhoa8"
|
|
44
78
|
#
|
|
45
79
|
# @faker.version 2.1.3
|
|
46
|
-
def characters(
|
|
47
|
-
warn_for_deprecated_arguments do |keywords|
|
|
48
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
|
49
|
-
end
|
|
50
|
-
|
|
80
|
+
def characters(number: 255, min_alpha: 0, min_numeric: 0)
|
|
51
81
|
Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
|
52
82
|
end
|
|
53
83
|
|
|
84
|
+
##
|
|
85
|
+
# Generates the emoji
|
|
86
|
+
#
|
|
87
|
+
# @return [String]
|
|
88
|
+
#
|
|
89
|
+
# @example
|
|
90
|
+
# Faker::Lorem.multibyte #=> "😀"
|
|
91
|
+
# Faker::Lorem.multibyte #=> "❤"
|
|
92
|
+
#
|
|
93
|
+
# @faker.version 2.1.3
|
|
54
94
|
def multibyte
|
|
55
95
|
sample(translate('faker.lorem.multibyte')).pack('C*').force_encoding('utf-8')
|
|
56
96
|
end
|
|
57
97
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
98
|
+
##
|
|
99
|
+
# Generates sentence
|
|
100
|
+
#
|
|
101
|
+
# @param word_count [Integer] How many words should be there in a sentence, default to 4
|
|
102
|
+
# @param supplemental [Boolean] Add supplemental words, default to false
|
|
103
|
+
# @param random_words_to_add [Integer] Add any random words, default to 0
|
|
104
|
+
#
|
|
105
|
+
# @return [String]
|
|
106
|
+
#
|
|
107
|
+
# @example
|
|
108
|
+
# Faker::Lorem.sentence #=> "Magnam qui aut quidem."
|
|
109
|
+
# Faker::Lorem.sentence(word_count: 5) #=> "Voluptas rerum aut aliquam velit."
|
|
110
|
+
# Faker::Lorem.sentence(word_count: 5, supplemental: true) #=> "Aut viscus curtus votum iusto."
|
|
111
|
+
# Faker::Lorem.sentence(word_count: 5, supplemental: true, random_words_to_add:2) #=> "Crinis quo cruentus velit animi vomer."
|
|
112
|
+
#
|
|
113
|
+
# @faker.version 2.1.3
|
|
114
|
+
def sentence(word_count: 4, supplemental: false, random_words_to_add: 0, exclude_words: nil)
|
|
115
|
+
words(number: word_count + rand(random_words_to_add.to_i), supplemental: supplemental, exclude_words: exclude_words).join(locale_space).capitalize + locale_period
|
|
68
116
|
end
|
|
69
117
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
118
|
+
##
|
|
119
|
+
# Generates three sentences
|
|
120
|
+
#
|
|
121
|
+
# @param number [Integer] How many sentences to be generated, default to 3
|
|
122
|
+
# @param supplemental [Boolean] Should add supplemental words, defaults to false
|
|
123
|
+
#
|
|
124
|
+
# @return [Array] Returns array for sentences.
|
|
125
|
+
#
|
|
126
|
+
# @example
|
|
127
|
+
# Faker::Lorem.sentences #=> ["Possimus non tenetur.", "Nulla non excepturi.", "Quisquam rerum facilis."]
|
|
128
|
+
# Faker::Lorem.sentences(number: 2) #=> ["Nulla est natus.", "Perferendis autem cum."]
|
|
129
|
+
# Faker::Lorem.sentences(number: 2, supplemental: true) #=> ["Cito cena ad.", "Solvo animus allatus."]
|
|
130
|
+
#
|
|
131
|
+
# @faker.version 2.1.3
|
|
132
|
+
def sentences(number: 3, supplemental: false, exclude_words: nil)
|
|
133
|
+
1.upto(resolve(number)).collect { sentence(word_count: 3, supplemental: supplemental, exclude_words: exclude_words) }
|
|
77
134
|
end
|
|
78
135
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
136
|
+
##
|
|
137
|
+
# Generates three sentence paragraph
|
|
138
|
+
#
|
|
139
|
+
# @param sentence_count [Integer] Number of sentences in the paragraph
|
|
140
|
+
# @param supplemental [Boolean]
|
|
141
|
+
# @param random_sentences_to_add [Integer]
|
|
142
|
+
#
|
|
143
|
+
# @return [String]
|
|
144
|
+
#
|
|
145
|
+
# @example
|
|
146
|
+
# Faker::Lorem.paragraph
|
|
147
|
+
# #=> "Impedit et est. Aliquid deleniti necessitatibus. Et aspernatur minima."
|
|
148
|
+
# Faker::Lorem.paragraph(sentence_count: 2)
|
|
149
|
+
# #=> "Rerum fugit vitae. Et atque autem."
|
|
150
|
+
# Faker::Lorem.paragraph(sentence_count: 2, supplemental: true)
|
|
151
|
+
# #=> "Terreo coerceo utor. Vester sunt cogito."
|
|
152
|
+
# Faker::Lorem.paragraph(sentence_count: 2, supplemental: true, random_sentences_to_add: 2)
|
|
153
|
+
# #=> "Texo tantillus tamisium. Tribuo amissio tamisium. Facere aut canis."
|
|
154
|
+
#
|
|
155
|
+
# @faker.version 2.1.3
|
|
156
|
+
def paragraph(sentence_count: 3, supplemental: false, random_sentences_to_add: 0, exclude_words: nil)
|
|
157
|
+
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i), supplemental: supplemental, exclude_words: exclude_words).join(locale_space)
|
|
89
158
|
end
|
|
90
159
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
160
|
+
##
|
|
161
|
+
# Generates three paragraphs
|
|
162
|
+
#
|
|
163
|
+
# @param number [Integer]
|
|
164
|
+
# @param supplemental [Boolean]
|
|
165
|
+
#
|
|
166
|
+
# @return [Array]
|
|
167
|
+
#
|
|
168
|
+
# @example
|
|
169
|
+
# Faker::Lorem.paragraphs
|
|
170
|
+
# Faker::Lorem.paragraphs(number:2)
|
|
171
|
+
# Faker::Lorem.paragraphs(number:2, supplemental: true)
|
|
172
|
+
#
|
|
173
|
+
# @faker.version 2.1.3
|
|
174
|
+
def paragraphs(number: 3, supplemental: false, exclude_words: nil)
|
|
175
|
+
1.upto(resolve(number)).collect { paragraph(sentence_count: 3, supplemental: supplemental, exclude_words: exclude_words) }
|
|
100
176
|
end
|
|
101
177
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
178
|
+
##
|
|
179
|
+
# Generates paragraph with 256 characters
|
|
180
|
+
#
|
|
181
|
+
# @param number [Integer]
|
|
182
|
+
# @param supplemental [Boolean]
|
|
183
|
+
#
|
|
184
|
+
# @return [String]
|
|
185
|
+
#
|
|
186
|
+
# @example
|
|
187
|
+
# Faker::Lorem.paragraph_by_chars
|
|
188
|
+
# Faker::Lorem.paragraph_by_chars(number: 20) #=> "Sit modi alias. Imp."
|
|
189
|
+
# Faker::Lorem.paragraph_by_chars(number: 20, supplemental: true) #=> "Certus aveho admove."
|
|
190
|
+
#
|
|
191
|
+
# @faker.version 2.1.3
|
|
192
|
+
def paragraph_by_chars(number: 256, supplemental: false)
|
|
108
193
|
paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
|
|
109
194
|
|
|
110
195
|
paragraph += " #{paragraph(sentence_count: 3, supplemental: supplemental)}" while paragraph.length < number
|
|
@@ -112,25 +197,42 @@ module Faker
|
|
|
112
197
|
"#{paragraph[0...number - 1]}."
|
|
113
198
|
end
|
|
114
199
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
200
|
+
##
|
|
201
|
+
# Returns the question with 4 words
|
|
202
|
+
#
|
|
203
|
+
# @param word_count [Integer]
|
|
204
|
+
# @param supplemental [Boolean]
|
|
205
|
+
# @param random_words_to_add [Integer]
|
|
206
|
+
#
|
|
207
|
+
# @return [String]
|
|
208
|
+
#
|
|
209
|
+
# @example
|
|
210
|
+
# Faker::Lorem.question #=> "Natus deleniti sequi laudantium?"
|
|
211
|
+
# Faker::Lorem.question(word_count: 2) #=> "Quo ut?"
|
|
212
|
+
# Faker::Lorem.question(word_count: 2, supplemental: true) #=> "Terga consequatur?"
|
|
213
|
+
# Faker::Lorem.question(word_count: 2, supplemental: true, random_words_to_add: 2) #=> "Depulso uter ut?"
|
|
214
|
+
#
|
|
215
|
+
# @faker.version 2.1.3
|
|
216
|
+
def question(word_count: 4, supplemental: false, random_words_to_add: 0, exclude_words: nil)
|
|
217
|
+
words(number: word_count + rand(random_words_to_add), supplemental: supplemental, exclude_words: exclude_words).join(' ').capitalize + locale_question_mark
|
|
125
218
|
end
|
|
126
219
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
220
|
+
##
|
|
221
|
+
# Generates array of three questions
|
|
222
|
+
#
|
|
223
|
+
# @param number [Integer]
|
|
224
|
+
# @param supplemental [Boolean]
|
|
225
|
+
#
|
|
226
|
+
# @return [Array]
|
|
227
|
+
#
|
|
228
|
+
# @example
|
|
229
|
+
# Faker::Lorem.questions #=> ["Amet culpa enim?", "Voluptatem deleniti numquam?", "Veniam non cum?"]
|
|
230
|
+
# Faker::Lorem.questions(number: 2) #=> ["Minus occaecati nobis?", "Veniam et alias?"]
|
|
231
|
+
# Faker::Lorem.questions(number: 2, supplemental: true) #=> ["Acceptus subito cetera?", "Aro sulum cubicularis?"]
|
|
232
|
+
#
|
|
233
|
+
# @faker.version 2.1.3
|
|
234
|
+
def questions(number: 3, supplemental: false, exclude_words: nil)
|
|
235
|
+
1.upto(resolve(number)).collect { question(word_count: 3, supplemental: supplemental, exclude_words: exclude_words) }
|
|
134
236
|
end
|
|
135
237
|
|
|
136
238
|
private
|
|
@@ -21,15 +21,7 @@ module Faker
|
|
|
21
21
|
# Faker::LoremFlickr.image(size: "50x60", search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/50/60/sports,fitness/all"
|
|
22
22
|
#
|
|
23
23
|
# @faker.version 1.9.0
|
|
24
|
-
|
|
25
|
-
def image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false)
|
|
26
|
-
# rubocop:enable Metrics/ParameterLists
|
|
27
|
-
warn_for_deprecated_arguments do |keywords|
|
|
28
|
-
keywords << :size if legacy_size != NOT_GIVEN
|
|
29
|
-
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
|
30
|
-
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
|
31
|
-
end
|
|
32
|
-
|
|
24
|
+
def image(size: '300x300', search_terms: [], match_all: false)
|
|
33
25
|
build_url(size, nil, search_terms, match_all)
|
|
34
26
|
end
|
|
35
27
|
|
|
@@ -49,15 +41,7 @@ module Faker
|
|
|
49
41
|
# Faker::LoremFlickr.grayscale_image(size: "50x60", search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/g/50/60/sports,fitness/all"
|
|
50
42
|
#
|
|
51
43
|
# @faker.version 1.9.0
|
|
52
|
-
|
|
53
|
-
def grayscale_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false)
|
|
54
|
-
# rubocop:enable Metrics/ParameterLists
|
|
55
|
-
warn_for_deprecated_arguments do |keywords|
|
|
56
|
-
keywords << :size if legacy_size != NOT_GIVEN
|
|
57
|
-
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
|
58
|
-
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
|
59
|
-
end
|
|
60
|
-
|
|
44
|
+
def grayscale_image(size: '300x300', search_terms: ['all'], match_all: false)
|
|
61
45
|
raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any?
|
|
62
46
|
|
|
63
47
|
build_url(size, 'g', search_terms, match_all)
|
|
@@ -79,15 +63,7 @@ module Faker
|
|
|
79
63
|
# Faker::LoremFlickr.pixelated_image(size: "50x60", search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/p/50/60/sports,fitness/all"
|
|
80
64
|
#
|
|
81
65
|
# @faker.version 1.9.0
|
|
82
|
-
|
|
83
|
-
def pixelated_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false)
|
|
84
|
-
# rubocop:enable Metrics/ParameterLists
|
|
85
|
-
warn_for_deprecated_arguments do |keywords|
|
|
86
|
-
keywords << :size if legacy_size != NOT_GIVEN
|
|
87
|
-
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
|
88
|
-
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
|
89
|
-
end
|
|
90
|
-
|
|
66
|
+
def pixelated_image(size: '300x300', search_terms: ['all'], match_all: false)
|
|
91
67
|
raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any?
|
|
92
68
|
|
|
93
69
|
build_url(size, 'p', search_terms, match_all)
|
|
@@ -110,16 +86,7 @@ module Faker
|
|
|
110
86
|
# Faker::LoremFlickr.image(size: "50x60", color: 'blue', search_terms: ['sports', 'fitness'], match_all: true) #=> "https://loremflickr.com/blue/50/60/sports,fitness/all"
|
|
111
87
|
#
|
|
112
88
|
# @faker.version 1.9.0
|
|
113
|
-
|
|
114
|
-
def colorized_image(legacy_size = NOT_GIVEN, legacy_color = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', color: 'red', search_terms: ['all'], match_all: false)
|
|
115
|
-
# rubocop:enable Metrics/ParameterLists
|
|
116
|
-
warn_for_deprecated_arguments do |keywords|
|
|
117
|
-
keywords << :size if legacy_size != NOT_GIVEN
|
|
118
|
-
keywords << :color if legacy_color != NOT_GIVEN
|
|
119
|
-
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
|
120
|
-
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
|
121
|
-
end
|
|
122
|
-
|
|
89
|
+
def colorized_image(size: '300x300', color: 'red', search_terms: ['all'], match_all: false)
|
|
123
90
|
raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?
|
|
124
91
|
raise ArgumentError, "Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}" unless SUPPORTED_COLORIZATIONS.include?(color)
|
|
125
92
|
|
|
@@ -27,7 +27,7 @@ module Faker
|
|
|
27
27
|
# @faker.version 1.8.0
|
|
28
28
|
def emphasis
|
|
29
29
|
paragraph = Faker::Lorem.paragraph(sentence_count: 3)
|
|
30
|
-
words = paragraph.split
|
|
30
|
+
words = paragraph.split
|
|
31
31
|
position = rand(0..words.length - 1)
|
|
32
32
|
formatting = fetch('markdown.emphasis')
|
|
33
33
|
words[position] = "#{formatting}#{words[position]}#{formatting}"
|
|
@@ -50,7 +50,7 @@ module Faker
|
|
|
50
50
|
number.times do |i|
|
|
51
51
|
result << "#{i}. #{Faker::Lorem.sentence(word_count: 1)} \n"
|
|
52
52
|
end
|
|
53
|
-
result.join
|
|
53
|
+
result.join
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
##
|
|
@@ -69,7 +69,7 @@ module Faker
|
|
|
69
69
|
number.times do |_i|
|
|
70
70
|
result << "* #{Faker::Lorem.sentence(word_count: 1)} \n"
|
|
71
71
|
end
|
|
72
|
-
result.join
|
|
72
|
+
result.join
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
##
|
|
@@ -117,9 +117,11 @@ module Faker
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
##
|
|
120
|
-
# Produces a random method from the methods above
|
|
120
|
+
# Produces a random method from the methods above, excluding the methods listed in the arguments.
|
|
121
|
+
#
|
|
122
|
+
# @overload random(methods)
|
|
123
|
+
# @param methods [Symbol] Specify which methods to exclude.
|
|
121
124
|
#
|
|
122
|
-
# @param methods [Symbol] Specify which methods to use.
|
|
123
125
|
# @return [String, Array<String>]
|
|
124
126
|
#
|
|
125
127
|
# @example
|
|
@@ -131,7 +133,7 @@ module Faker
|
|
|
131
133
|
def random(*args)
|
|
132
134
|
method_list = available_methods
|
|
133
135
|
args&.each { |ex| method_list.delete_if { |meth| meth == ex.to_sym } }
|
|
134
|
-
send(method_list[rand(0..method_list.length - 1)])
|
|
136
|
+
send(method_list[Faker::Config.random.rand(0..method_list.length - 1)])
|
|
135
137
|
end
|
|
136
138
|
|
|
137
139
|
##
|
|
@@ -148,12 +150,7 @@ module Faker
|
|
|
148
150
|
# Faker::Markdown.sandwich(sentences: 6, repeat: 3) #=> returns newline separated content of 1 header, and then 3 sections consisting of, here, 1 6-sentence lorem paragraph and 1 random markdown element. The random markdown element is chosen at random in each iteration of the paragraph-markdown pairing.
|
|
149
151
|
#
|
|
150
152
|
# @faker.version 1.8.0
|
|
151
|
-
def sandwich(
|
|
152
|
-
warn_for_deprecated_arguments do |keywords|
|
|
153
|
-
keywords << :sentences if legacy_sentences != NOT_GIVEN
|
|
154
|
-
keywords << :repeat if legacy_repeat != NOT_GIVEN
|
|
155
|
-
end
|
|
156
|
-
|
|
153
|
+
def sandwich(sentences: 3, repeat: 1)
|
|
157
154
|
text_block = []
|
|
158
155
|
text_block << headers
|
|
159
156
|
repeat.times do
|
|
@@ -166,7 +163,7 @@ module Faker
|
|
|
166
163
|
private
|
|
167
164
|
|
|
168
165
|
def available_methods
|
|
169
|
-
Markdown.public_methods(false) - Base.methods
|
|
166
|
+
(Markdown.public_methods(false) - Base.methods).sort
|
|
170
167
|
end
|
|
171
168
|
end
|
|
172
169
|
end
|
|
@@ -9,7 +9,7 @@ module Faker
|
|
|
9
9
|
##
|
|
10
10
|
# Produces a random height measurement.
|
|
11
11
|
#
|
|
12
|
-
# @param amount [Integer]
|
|
12
|
+
# @param amount [Integer] Specifies the random height value.
|
|
13
13
|
# @return [String]
|
|
14
14
|
#
|
|
15
15
|
# @example
|
|
@@ -19,18 +19,14 @@ module Faker
|
|
|
19
19
|
# Faker::Measurement.height(amount: "all") #=> "inches"
|
|
20
20
|
#
|
|
21
21
|
# @faker.version 1.7.3
|
|
22
|
-
def height(
|
|
23
|
-
warn_for_deprecated_arguments do |keywords|
|
|
24
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
25
|
-
end
|
|
26
|
-
|
|
22
|
+
def height(amount: rand(10))
|
|
27
23
|
define_measurement_locale(amount, 'height')
|
|
28
24
|
end
|
|
29
25
|
|
|
30
26
|
##
|
|
31
27
|
# Produces a random length measurement.
|
|
32
28
|
#
|
|
33
|
-
# @param amount [Integer]
|
|
29
|
+
# @param amount [Integer] Specifies the random length value.
|
|
34
30
|
# @return [String]
|
|
35
31
|
#
|
|
36
32
|
# @example
|
|
@@ -38,18 +34,14 @@ module Faker
|
|
|
38
34
|
# Faker::Measurement.length(amount: 1.4) #=> "1.4 yards"
|
|
39
35
|
#
|
|
40
36
|
# @faker.version 1.7.3
|
|
41
|
-
def length(
|
|
42
|
-
warn_for_deprecated_arguments do |keywords|
|
|
43
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
44
|
-
end
|
|
45
|
-
|
|
37
|
+
def length(amount: rand(10))
|
|
46
38
|
define_measurement_locale(amount, 'length')
|
|
47
39
|
end
|
|
48
40
|
|
|
49
41
|
##
|
|
50
42
|
# Produces a random volume measurement.
|
|
51
43
|
#
|
|
52
|
-
# @param amount [Integer]
|
|
44
|
+
# @param amount [Integer] Specifies the random volume value.
|
|
53
45
|
# @return [String]
|
|
54
46
|
#
|
|
55
47
|
# @example
|
|
@@ -57,18 +49,14 @@ module Faker
|
|
|
57
49
|
# Faker::Measurement.volume(amount: 1.4) #=> "1.4 cups"
|
|
58
50
|
#
|
|
59
51
|
# @faker.version 1.7.3
|
|
60
|
-
def volume(
|
|
61
|
-
warn_for_deprecated_arguments do |keywords|
|
|
62
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
63
|
-
end
|
|
64
|
-
|
|
52
|
+
def volume(amount: rand(10))
|
|
65
53
|
define_measurement_locale(amount, 'volume')
|
|
66
54
|
end
|
|
67
55
|
|
|
68
56
|
##
|
|
69
57
|
# Produces a random weight measurement.
|
|
70
58
|
#
|
|
71
|
-
# @param amount [Integer]
|
|
59
|
+
# @param amount [Integer] Specifies the random weight value.
|
|
72
60
|
# @return [String]
|
|
73
61
|
#
|
|
74
62
|
# @example
|
|
@@ -76,18 +64,14 @@ module Faker
|
|
|
76
64
|
# Faker::Measurement.weight(amount: 1.4) #=> "1.4 pounds"
|
|
77
65
|
#
|
|
78
66
|
# @faker.version 1.7.3
|
|
79
|
-
def weight(
|
|
80
|
-
warn_for_deprecated_arguments do |keywords|
|
|
81
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
82
|
-
end
|
|
83
|
-
|
|
67
|
+
def weight(amount: rand(10))
|
|
84
68
|
define_measurement_locale(amount, 'weight')
|
|
85
69
|
end
|
|
86
70
|
|
|
87
71
|
##
|
|
88
72
|
# Produces a random metric height measurement.
|
|
89
73
|
#
|
|
90
|
-
# @param amount [Integer]
|
|
74
|
+
# @param amount [Integer] Specifies the random height value.
|
|
91
75
|
# @return [String]
|
|
92
76
|
#
|
|
93
77
|
# @example
|
|
@@ -95,18 +79,14 @@ module Faker
|
|
|
95
79
|
# Faker::Measurement.metric_height(amount: 1.4) #=> "1.4 meters"
|
|
96
80
|
#
|
|
97
81
|
# @faker.version 1.7.3
|
|
98
|
-
def metric_height(
|
|
99
|
-
warn_for_deprecated_arguments do |keywords|
|
|
100
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
101
|
-
end
|
|
102
|
-
|
|
82
|
+
def metric_height(amount: rand(10))
|
|
103
83
|
define_measurement_locale(amount, 'metric_height')
|
|
104
84
|
end
|
|
105
85
|
|
|
106
86
|
##
|
|
107
87
|
# Produces a random metric length measurement.
|
|
108
88
|
#
|
|
109
|
-
# @param amount [Integer]
|
|
89
|
+
# @param amount [Integer] Specifies the random length value.
|
|
110
90
|
# @return [String]
|
|
111
91
|
#
|
|
112
92
|
# @example
|
|
@@ -114,18 +94,14 @@ module Faker
|
|
|
114
94
|
# Faker::Measurement.metric_length(amount: 1.4) #=> "1.4 decimeters"
|
|
115
95
|
#
|
|
116
96
|
# @faker.version 1.7.3
|
|
117
|
-
def metric_length(
|
|
118
|
-
warn_for_deprecated_arguments do |keywords|
|
|
119
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
120
|
-
end
|
|
121
|
-
|
|
97
|
+
def metric_length(amount: rand(10))
|
|
122
98
|
define_measurement_locale(amount, 'metric_length')
|
|
123
99
|
end
|
|
124
100
|
|
|
125
101
|
##
|
|
126
102
|
# Produces a random metric volume measurement.
|
|
127
103
|
#
|
|
128
|
-
# @param amount [Integer]
|
|
104
|
+
# @param amount [Integer] Specifies the random volume value.
|
|
129
105
|
# @return [String]
|
|
130
106
|
#
|
|
131
107
|
# @example
|
|
@@ -133,18 +109,14 @@ module Faker
|
|
|
133
109
|
# Faker::Measurement.metric_volume(amount: 1.4) #=> "1.4 liters"
|
|
134
110
|
#
|
|
135
111
|
# @faker.version 1.7.3
|
|
136
|
-
def metric_volume(
|
|
137
|
-
warn_for_deprecated_arguments do |keywords|
|
|
138
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
139
|
-
end
|
|
140
|
-
|
|
112
|
+
def metric_volume(amount: rand(10))
|
|
141
113
|
define_measurement_locale(amount, 'metric_volume')
|
|
142
114
|
end
|
|
143
115
|
|
|
144
116
|
##
|
|
145
117
|
# Produces a random metric weight measurement.
|
|
146
118
|
#
|
|
147
|
-
# @param amount [Integer]
|
|
119
|
+
# @param amount [Integer] Specifies the random weight value.
|
|
148
120
|
# @return [String]
|
|
149
121
|
#
|
|
150
122
|
# @example
|
|
@@ -152,11 +124,7 @@ module Faker
|
|
|
152
124
|
# Faker::Measurement.metric_weight(amount: 1.4) #=> "1.4 grams"
|
|
153
125
|
#
|
|
154
126
|
# @faker.version 1.7.3
|
|
155
|
-
def metric_weight(
|
|
156
|
-
warn_for_deprecated_arguments do |keywords|
|
|
157
|
-
keywords << :amount if legacy_amount != NOT_GIVEN
|
|
158
|
-
end
|
|
159
|
-
|
|
127
|
+
def metric_weight(amount: rand(10))
|
|
160
128
|
define_measurement_locale(amount, 'metric_weight')
|
|
161
129
|
end
|
|
162
130
|
|