faker 2.13.0 → 3.8.0
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 +1277 -24
- data/README.md +138 -320
- data/lib/faker/blockchain/aeternity.rb +5 -5
- data/lib/faker/blockchain/bitcoin.rb +1 -2
- data/lib/faker/blockchain/ethereum.rb +1 -1
- data/lib/faker/blockchain/tezos.rb +30 -3
- data/lib/faker/blockchain.rb +9 -0
- data/lib/faker/books/dune.rb +17 -12
- data/lib/faker/books/lovecraft.rb +16 -44
- data/lib/faker/books/the_kingkiller_chronicle.rb +61 -0
- data/lib/faker/books.rb +9 -0
- data/lib/faker/creature/bird.rb +203 -0
- data/lib/faker/creature.rb +9 -0
- data/lib/faker/default/address.rb +11 -31
- data/lib/faker/default/adjective.rb +35 -0
- data/lib/faker/default/alphanumeric.rb +3 -9
- data/lib/faker/default/app.rb +1 -10
- data/lib/faker/default/avatar.rb +2 -13
- data/lib/faker/default/bank.rb +28 -26
- data/lib/faker/default/barcode.rb +165 -0
- data/lib/faker/default/beer.rb +3 -3
- data/lib/faker/default/boolean.rb +2 -4
- data/lib/faker/default/camera.rb +46 -0
- data/lib/faker/default/cannabis.rb +10 -0
- data/lib/faker/default/chile_rut.rb +28 -27
- data/lib/faker/default/chuck_norris.rb +1 -0
- data/lib/faker/default/code.rb +166 -52
- data/lib/faker/default/color.rb +77 -6
- data/lib/faker/default/commerce.rb +32 -18
- data/lib/faker/default/company.rb +175 -30
- data/lib/faker/default/crypto.rb +25 -5
- 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 +45 -20
- data/lib/faker/default/drone.rb +332 -0
- 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 +51 -7
- data/lib/faker/default/food.rb +28 -2
- data/lib/faker/default/hipster.rb +15 -52
- data/lib/faker/default/hobby.rb +22 -0
- data/lib/faker/default/html.rb +230 -0
- data/lib/faker/default/id_number.rb +176 -31
- data/lib/faker/default/invoice.rb +8 -21
- data/lib/faker/default/json.rb +15 -27
- data/lib/faker/default/lorem.rb +179 -77
- data/lib/faker/default/lorem_flickr.rb +5 -38
- data/lib/faker/default/markdown.rb +14 -17
- data/lib/faker/default/marketing.rb +1 -1
- data/lib/faker/default/measurement.rb +19 -50
- data/lib/faker/default/military.rb +26 -0
- data/lib/faker/default/mountain.rb +33 -0
- 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} +10 -10
- data/lib/faker/default/number.rb +34 -62
- data/lib/faker/default/omniauth.rb +102 -97
- data/lib/faker/default/phone_number.rb +36 -21
- data/lib/faker/default/placeholdit.rb +12 -22
- data/lib/faker/{quotes → default}/quote.rb +39 -0
- data/lib/faker/default/relationship.rb +2 -6
- 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/space.rb +1 -1
- data/lib/faker/default/sport.rb +116 -0
- data/lib/faker/default/string.rb +2 -8
- data/lib/faker/default/stripe.rb +7 -23
- data/lib/faker/default/tea.rb +41 -0
- data/lib/faker/{music/show.rb → default/theater.rb} +8 -8
- data/lib/faker/default/time.rb +4 -34
- data/lib/faker/default/types.rb +14 -36
- data/lib/faker/default/vehicle.rb +45 -55
- data/lib/faker/default/vulnerability_identifier.rb +23 -0
- data/lib/faker/default/world_cup.rb +2 -11
- data/lib/faker/default/x.rb +189 -0
- data/lib/faker/default.rb +9 -0
- data/lib/faker/fantasy/tolkien.rb +67 -0
- data/lib/faker/fantasy.rb +9 -0
- data/lib/faker/games/clash_of_clans.rb +48 -0
- data/lib/faker/games/control.rb +1 -1
- data/lib/faker/games/dnd.rb +131 -14
- data/lib/faker/games/dota.rb +14 -5
- data/lib/faker/games/elder_scrolls.rb +26 -0
- data/lib/faker/games/final_fantasy_xiv.rb +73 -0
- data/lib/faker/games/heroes.rb +13 -0
- data/lib/faker/games/heroes_of_the_storm.rb +0 -11
- data/lib/faker/games/minecraft.rb +66 -1
- data/lib/faker/games/myst.rb +1 -1
- data/lib/faker/games/street_fighter.rb +61 -0
- data/lib/faker/games/super_mario.rb +48 -0
- 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/games/world_of_warcraft.rb +26 -1
- data/lib/faker/games.rb +9 -0
- data/lib/faker/internet.rb +582 -0
- data/lib/faker/japanese_media/conan.rb +48 -0
- data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
- data/lib/faker/japanese_media/doraemon.rb +48 -0
- data/lib/faker/japanese_media/dragon_ball.rb +26 -0
- data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +48 -0
- data/lib/faker/japanese_media/kamen_rider.rb +102 -0
- data/lib/faker/japanese_media/naruto.rb +61 -0
- data/lib/faker/japanese_media/one_piece.rb +1 -1
- data/lib/faker/japanese_media/studio_ghibli.rb +48 -0
- data/lib/faker/japanese_media.rb +9 -0
- data/lib/faker/locations/australia.rb +49 -0
- data/lib/faker/locations.rb +9 -0
- data/lib/faker/movies/avatar.rb +49 -0
- data/lib/faker/movies/hackers.rb +48 -0
- data/lib/faker/movies/hobbit.rb +4 -4
- data/lib/faker/movies/how_to_train_your_dragon.rb +48 -0
- data/lib/faker/movies/lord_of_the_rings.rb +3 -3
- data/lib/faker/movies/star_wars.rb +75 -7
- data/lib/faker/movies/the_room.rb +63 -0
- data/lib/faker/movies/tron.rb +161 -0
- data/lib/faker/movies.rb +9 -0
- data/lib/faker/music/bossa_nova.rb +35 -0
- data/lib/faker/music/grateful_dead.rb +0 -2
- data/lib/faker/music/hiphop.rb +48 -0
- data/lib/faker/music/opera.rb +237 -1
- data/lib/faker/music/pearl_jam.rb +0 -2
- data/lib/faker/music/rock_band.rb +12 -0
- data/lib/faker/music/rush.rb +0 -2
- data/lib/faker/music/smashing_pumpkins.rb +62 -0
- data/lib/faker/{music/music.rb → music.rb} +16 -0
- data/lib/faker/quotes/rajnikanth.rb +1 -0
- data/lib/faker/quotes/shakespeare.rb +34 -0
- data/lib/faker/quotes.rb +9 -0
- data/lib/faker/religion/bible.rb +50 -0
- data/lib/faker/religion.rb +9 -0
- data/lib/faker/sports/chess.rb +90 -0
- data/lib/faker/sports/mountaineering.rb +22 -0
- data/lib/faker/sports/volleyball.rb +74 -0
- data/lib/faker/sports.rb +9 -0
- data/lib/faker/travel/airport.rb +43 -0
- data/lib/faker/travel/train_station.rb +54 -0
- data/lib/faker/travel.rb +9 -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/buffy.rb +5 -5
- data/lib/faker/tv_shows/dr_who.rb +0 -13
- data/lib/faker/tv_shows/final_space.rb +51 -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_fresh_prince_of_bel_air.rb +5 -5
- data/lib/faker/tv_shows/the_office.rb +37 -0
- data/lib/faker/tv_shows.rb +9 -0
- data/lib/faker/version.rb +2 -2
- data/lib/faker.rb +96 -79
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/deprecator.rb +118 -0
- data/lib/helpers/positional_generator.rb +478 -0
- data/lib/helpers/unique_generator.rb +14 -14
- data/lib/locales/README.md +18 -2
- data/lib/locales/ar.yml +1608 -46
- data/lib/locales/bg.yml +935 -19
- data/lib/locales/ca-CAT.yml +347 -12
- data/lib/locales/ca.yml +580 -7
- data/lib/locales/da-DK.yml +529 -35
- data/lib/locales/de-AT.yml +3487 -25
- data/lib/locales/de-CH.yml +4359 -10
- data/lib/locales/de.yml +7185 -97
- data/lib/locales/ee.yml +1185 -27
- data/lib/locales/en/address.yml +1826 -562
- data/lib/locales/en/adjective.yml +179 -0
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/ancient.yml +128 -4
- data/lib/locales/en/animal.yml +141 -2
- data/lib/locales/en/app.yml +89 -2
- data/lib/locales/en/appliance.yml +81 -2
- data/lib/locales/en/aqua_teen_hunger_force.yml +31 -31
- data/lib/locales/en/archer.yml +75 -0
- data/lib/locales/en/artist.yml +43 -1
- data/lib/locales/en/australia.yml +108 -0
- data/lib/locales/en/avatar.yml +57 -0
- data/lib/locales/en/back_to_the_future.yml +145 -117
- data/lib/locales/en/bank.yml +92 -3
- data/lib/locales/en/barcode.yml +24 -0
- data/lib/locales/en/beer.yml +232 -6
- data/lib/locales/en/bible.yml +87 -0
- data/lib/locales/en/big_bang_theory.yml +34 -35
- data/lib/locales/en/bird.yml +1280 -0
- data/lib/locales/en/bojack_horseman.yml +63 -3
- data/lib/locales/en/book.yml +486 -3
- data/lib/locales/en/bossa_nova.yml +110 -3
- data/lib/locales/en/breaking_bad.yml +110 -25
- data/lib/locales/en/brooklyn_nine_nine.yml +34 -0
- data/lib/locales/en/buffy.yml +239 -257
- data/lib/locales/en/business.yml +18 -2
- data/lib/locales/en/camera.yml +611 -0
- data/lib/locales/en/cannabis.yml +344 -10
- data/lib/locales/en/cat.yml +155 -3
- data/lib/locales/en/chess.yml +102 -0
- data/lib/locales/en/chiquito.yml +60 -61
- data/lib/locales/en/chuck_norris.yml +78 -79
- data/lib/locales/en/clash_of_clan.yml +99 -0
- data/lib/locales/en/code.yml +501 -1
- data/lib/locales/en/coffee.yml +450 -25
- data/lib/locales/en/color.yml +73 -1
- data/lib/locales/en/commerce.yml +117 -6
- data/lib/locales/en/community.yml +55 -30
- data/lib/locales/en/company.yml +1756 -13
- data/lib/locales/en/compass.yml +108 -12
- data/lib/locales/en/computer.yml +23 -4
- data/lib/locales/en/conan.yml +169 -0
- data/lib/locales/en/construction.yml +416 -422
- data/lib/locales/en/cosmere.yml +219 -54
- data/lib/locales/en/cowboy_bebop.yml +160 -0
- data/lib/locales/en/culture_series.yml +298 -298
- data/lib/locales/en/currency.yml +358 -3
- data/lib/locales/en/dc_comics.yml +178 -49
- data/lib/locales/en/demographic.yml +218 -5
- data/lib/locales/en/departed.yml +40 -44
- data/lib/locales/en/dessert.yml +78 -3
- data/lib/locales/en/device.yml +112 -4
- data/lib/locales/en/dnd.yml +615 -33
- data/lib/locales/en/dog.yml +262 -7
- data/lib/locales/en/doraemon.yml +284 -0
- data/lib/locales/en/dota.yml +704 -63
- data/lib/locales/en/dr_who.yml +468 -93
- data/lib/locales/en/dragon_ball.yml +243 -1
- data/lib/locales/en/driving_license.yml +181 -0
- data/lib/locales/en/drone.yml +95 -0
- data/lib/locales/en/dumb_and_dumber.yml +72 -56
- data/lib/locales/en/dune.yml +270 -131
- data/lib/locales/en/educator.yml +6 -0
- data/lib/locales/en/elder_scrolls.yml +582 -9
- data/lib/locales/en/electrical_components.yml +49 -3
- data/lib/locales/en/emotion.yml +480 -0
- data/lib/locales/en/esport.yml +58 -5
- data/lib/locales/en/fallout.yml +311 -133
- data/lib/locales/en/family_guy.yml +54 -4
- data/lib/locales/en/file.yml +109 -2
- data/lib/locales/en/final_fantasy_xiv.yml +754 -0
- data/lib/locales/en/final_space.yml +35 -0
- data/lib/locales/en/finance.yml +80 -4
- data/lib/locales/en/food.yml +1067 -10
- data/lib/locales/en/football.yml +121 -5
- data/lib/locales/en/fresh_prince_of_bel_air.yml +119 -70
- data/lib/locales/en/friends.yml +162 -3
- data/lib/locales/en/fullmetal_alchemist_brotherhood.yml +78 -0
- data/lib/locales/en/funny_name.yml +752 -1
- data/lib/locales/en/futurama.yml +7 -15
- data/lib/locales/en/game.yml +11 -0
- data/lib/locales/en/game_of_thrones.yml +2487 -5
- data/lib/locales/en/gender.yml +15 -3
- data/lib/locales/en/ghostbusters.yml +101 -88
- data/lib/locales/en/grateful_dead.yml +47 -45
- data/lib/locales/en/greek_philosophers.yml +44 -23
- data/lib/locales/en/hacker.yml +110 -5
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/half_life.yml +84 -3
- data/lib/locales/en/harry_potter.yml +323 -6
- data/lib/locales/en/heroes.yml +408 -3
- data/lib/locales/en/heroes_of_the_storm.yml +131 -4
- data/lib/locales/en/hey_arnold.yml +104 -21
- data/lib/locales/en/hipster.yml +203 -1
- data/lib/locales/en/hitchhikers_guide_to_the_galaxy.yml +243 -42
- data/lib/locales/en/hobby.yml +170 -0
- data/lib/locales/en/horse.yml +446 -2
- data/lib/locales/en/house.yml +34 -2
- data/lib/locales/en/how_i_met_your_mother.yml +97 -25
- data/lib/locales/en/how_to_train_your_dragon.yml +173 -0
- data/lib/locales/en/id_number.yml +7 -2
- data/lib/locales/en/industry_segments.yml +188 -4
- data/lib/locales/en/internet.yml +136 -3
- data/lib/locales/en/jack_handey.yml +54 -0
- data/lib/locales/en/job.yml +98 -7
- data/lib/locales/en/kamen_rider.yml +718 -0
- data/lib/locales/en/kpop.yml +954 -80
- data/lib/locales/en/league_of_legends.yml +285 -6
- data/lib/locales/en/lebowski.yml +58 -40
- data/lib/locales/en/lorem.yml +1095 -6
- data/lib/locales/en/lovecraft.yml +76 -6
- data/lib/locales/en/markdown.yml +12 -2
- data/lib/locales/en/marketing.yml +54 -1
- data/lib/locales/en/measurement.yml +42 -8
- data/lib/locales/en/michael_scott.yml +41 -42
- data/lib/locales/en/military.yml +179 -5
- data/lib/locales/en/minecraft.yml +273 -0
- data/lib/locales/en/mitch_hedberg.yml +46 -0
- data/lib/locales/en/mountain.yml +171 -0
- data/lib/locales/en/mountaineering.yml +14 -0
- data/lib/locales/en/movie.yml +188 -175
- data/lib/locales/en/music.yml +461 -29
- data/lib/locales/en/myst.yml +87 -31
- data/lib/locales/en/name.yml +6068 -6
- data/lib/locales/en/naruto.yml +230 -0
- data/lib/locales/en/nato_phonetic_alphabet.yml +27 -1
- data/lib/locales/en/new_girl.yml +35 -37
- data/lib/locales/en/one_piece.yml +359 -6
- data/lib/locales/en/opera.yml +169 -1
- data/lib/locales/en/overwatch.yml +2648 -2622
- data/lib/locales/en/parks_and_rec.yml +33 -4
- data/lib/locales/en/pearl_jam.yml +207 -207
- data/lib/locales/en/phish.yml +388 -389
- data/lib/locales/en/phone_number.yml +78 -3
- data/lib/locales/en/pokemon.yml +417 -4
- data/lib/locales/en/prince.yml +219 -219
- data/lib/locales/en/princess_bride.yml +48 -2
- data/lib/locales/en/programming_language.yml +753 -3
- data/lib/locales/en/quote.yml +606 -163
- data/lib/locales/en/rajnikanth.yml +74 -74
- data/lib/locales/en/relationship.yml +29 -6
- data/lib/locales/en/restaurant.yml +31 -31
- data/lib/locales/en/rick_and_morty.yml +116 -3
- data/lib/locales/en/rock_band.yml +228 -1
- data/lib/locales/en/rupaul.yml +120 -122
- data/lib/locales/en/science.yml +481 -3
- data/lib/locales/en/seinfeld.yml +110 -3
- data/lib/locales/en/shakespeare.yml +46 -53
- data/lib/locales/en/silicon_valley.yml +122 -50
- data/lib/locales/en/simpsons.yml +897 -691
- data/lib/locales/en/slack_emoji.yml +874 -8
- data/lib/locales/en/smashing_pumpkins.yml +382 -0
- data/lib/locales/en/source.yml +35 -0
- data/lib/locales/en/south_park.yml +360 -2
- data/lib/locales/en/space.yml +373 -14
- data/lib/locales/en/spongebob.yml +489 -0
- data/lib/locales/en/sport.yml +130 -0
- data/lib/locales/en/star_trek.yml +105 -4
- data/lib/locales/en/star_wars.yml +525 -528
- data/lib/locales/en/stargate.yml +65 -18
- data/lib/locales/en/stranger_thing.yml +31 -33
- data/lib/locales/en/street_fighter.yml +1524 -0
- data/lib/locales/en/studio_ghibli.yml +107 -0
- data/lib/locales/en/subscription.yml +47 -5
- data/lib/locales/en/super_mario.yml +58 -0
- data/lib/locales/en/super_smash_bros.yml +23 -6
- data/lib/locales/en/superhero.yml +574 -4
- data/lib/locales/en/supernatural.yml +141 -0
- data/lib/locales/en/sword_art_online.yml +327 -331
- data/lib/locales/en/tarkov.yml +593 -0
- data/lib/locales/en/tea.yml +172 -0
- data/lib/locales/en/team.yml +125 -3
- data/lib/locales/en/the_expanse.yml +92 -4
- data/lib/locales/en/the_it_crowd.yml +148 -152
- data/lib/locales/en/the_kingkiller_chronicle.yml +56 -0
- data/lib/locales/en/the_office.yml +82 -0
- data/lib/locales/en/the_room.yml +68 -0
- data/lib/locales/en/the_thick_of_it.yml +83 -3
- data/lib/locales/en/theater.yml +597 -0
- data/lib/locales/en/tolkien.yml +2453 -0
- 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/twin_peaks.yml +130 -3
- data/lib/locales/en/umphreys_mcgee.yml +266 -1
- data/lib/locales/en/university.yml +15 -2
- data/lib/locales/en/v_for_vendetta.yml +157 -160
- data/lib/locales/en/vehicle.yml +2809 -75
- data/lib/locales/en/venture_bros.yml +225 -4
- data/lib/locales/en/verbs.yml +3785 -5
- data/lib/locales/en/volleyball.yml +501 -0
- data/lib/locales/en/warhammer_fantasy.yml +540 -573
- data/lib/locales/en/witcher.yml +426 -7
- data/lib/locales/en/world_cup.yml +1132 -235
- data/lib/locales/en/world_of_warcraft.yml +122 -4
- data/lib/locales/en/yoda.yml +38 -1
- data/lib/locales/en/zelda.yml +962 -4
- data/lib/locales/en-AU.yml +725 -48
- data/lib/locales/en-BORK.yml +104 -1
- data/lib/locales/en-CA.yml +373 -18
- data/lib/locales/en-GB.yml +118 -8
- data/lib/locales/en-IND.yml +1259 -16
- data/lib/locales/en-KE.yml +212 -0
- data/lib/locales/en-MS.yml +364 -16
- data/lib/locales/en-NEP.yml +212 -35
- data/lib/locales/en-NG.yml +737 -65
- data/lib/locales/en-NZ.yml +1153 -121
- data/lib/locales/en-PAK.yml +392 -9
- data/lib/locales/en-SG.yml +581 -15
- data/lib/locales/en-TH.yml +1 -1
- data/lib/locales/en-UG.yml +374 -75
- data/lib/locales/en-US.yml +6921 -81
- data/lib/locales/en-ZA.yml +1394 -13
- data/lib/locales/en-au-ocker.yml +266 -21
- data/lib/locales/en.yml +0 -3
- data/lib/locales/es-AR.yml +4570 -0
- data/lib/locales/es-MX.yml +1907 -41
- data/lib/locales/es.yml +2172 -52
- data/lib/locales/fa.yml +1624 -5
- data/lib/locales/fi-FI.yml +316 -16
- data/lib/locales/fr/address.yml +773 -0
- data/lib/locales/fr/adjective.yml +266 -0
- data/lib/locales/fr/ancient.yml +141 -0
- data/lib/locales/fr/animal.yml +122 -0
- data/lib/locales/fr/appliance.yml +69 -0
- data/lib/locales/fr/book.yml +31 -0
- data/lib/locales/fr/color.yml +34 -0
- data/lib/locales/fr/company.yml +497 -0
- data/lib/locales/fr/compass.yml +71 -0
- data/lib/locales/fr/demographic.yml +6 -0
- data/lib/locales/fr/gender.yml +21 -0
- data/lib/locales/fr/internet.yml +15 -0
- data/lib/locales/fr/lorem.yml +1094 -0
- data/lib/locales/fr/measurement.yml +34 -0
- data/lib/locales/fr/name.yml +1193 -0
- data/lib/locales/fr/phone_number.yml +38 -0
- data/lib/locales/fr/pokemon.yml +421 -0
- data/lib/locales/fr-CA.yml +2754 -45
- data/lib/locales/fr-CH.yml +2455 -42
- data/lib/locales/fr.yml +2 -112
- data/lib/locales/he.yml +255 -9
- data/lib/locales/hy.yml +3630 -119
- data/lib/locales/id.yml +839 -10
- data/lib/locales/it.yml +1310 -31
- data/lib/locales/ja/README.md +13 -0
- data/lib/locales/ja/address.yml +363 -0
- data/lib/locales/ja/adjective.yml +148 -0
- data/lib/locales/ja/ancient.yml +18 -0
- data/lib/locales/ja/animal.yml +87 -0
- data/lib/locales/ja/artist.yml +46 -0
- data/lib/locales/ja/bank.yml +139 -0
- data/lib/locales/ja/book.yml +496 -0
- data/lib/locales/ja/cat.yml +79 -0
- data/lib/locales/ja/coffee.yml +22 -0
- data/lib/locales/ja/color.yml +35 -0
- data/lib/locales/ja/commerce.yml +103 -0
- data/lib/locales/ja/company.yml +26 -0
- data/lib/locales/ja/dog.yml +339 -0
- data/lib/locales/ja/emotion.yml +49 -0
- data/lib/locales/ja/food.yml +41 -0
- data/lib/locales/ja/football.yml +115 -0
- data/lib/locales/ja/gender.yml +6 -0
- data/lib/locales/ja/lorem.yml +1020 -0
- data/lib/locales/ja/name.yml +213 -0
- data/lib/locales/ja/naruto.yml +230 -0
- data/lib/locales/ja/overwatch.yml +37 -0
- data/lib/locales/ja/phone_number.yml +13 -0
- data/lib/locales/ja/pokemon.yml +441 -0
- data/lib/locales/ja/relationship.yml +33 -0
- data/lib/locales/ja/restaurant.yml +82 -0
- data/lib/locales/ja/space.yml +23 -0
- data/lib/locales/ja/sport.yml +130 -0
- data/lib/locales/ja/studio_ghibli.yml +112 -0
- data/lib/locales/ja/subscription.yml +50 -0
- data/lib/locales/ja/super_mario.yml +73 -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 +22 -0
- data/lib/locales/ja/zelda.yml +19 -0
- data/lib/locales/ko.yml +1380 -29
- data/lib/locales/lt.yml +315 -0
- data/lib/locales/lv.yml +1221 -27
- data/lib/locales/mi-NZ.yml +283 -0
- data/lib/locales/nb-NO.yml +518 -27
- data/lib/locales/nl.yml +33514 -55
- data/lib/locales/pl.yml +4008 -38
- data/lib/locales/pt-BR.yml +8207 -660
- data/lib/locales/pt.yml +844 -43
- data/lib/locales/ru.yml +1355 -30
- data/lib/locales/sk.yml +4416 -41
- data/lib/locales/sv.yml +731 -41
- data/lib/locales/th.yml +375 -375
- data/lib/locales/tr.yml +77 -19
- data/lib/locales/uk.yml +1810 -44
- data/lib/locales/vi.yml +392 -48
- data/lib/locales/zh-CN/bank.yml +17 -0
- data/lib/locales/zh-CN.yml +540 -18
- data/lib/locales/zh-TW.yml +1030 -14
- metadata +188 -141
- data/History.md +0 -176
- data/lib/faker/default/bossa_nova.rb +0 -33
- data/lib/faker/default/fillmurray.rb +0 -45
- data/lib/faker/default/internet.rb +0 -358
- data/lib/faker/default/lorem_pixel.rb +0 -69
- data/lib/faker/default/twitter.rb +0 -223
- data/lib/locales/en/hobbit.yml +0 -19
- data/lib/locales/en/lord_of_the_rings.yml +0 -6
- data/lib/locales/en/show.yml +0 -597
- data/lib/locales/ja.yml +0 -101
- /data/lib/faker/{books → default}/book.rb +0 -0
- /data/lib/faker/{games → default}/game.rb +0 -0
- /data/lib/faker/{movies → default}/movie.rb +0 -0
- /data/lib/faker/{default/internet_http.rb → internet/http.rb} +0 -0
data/lib/faker/default/lorem.rb
CHANGED
|
@@ -4,27 +4,61 @@ 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
|
-
sample(Types::CHARACTERS)
|
|
61
|
+
sample(Faker::Types::CHARACTERS)
|
|
28
62
|
end
|
|
29
63
|
|
|
30
64
|
##
|
|
@@ -43,94 +77,162 @@ 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
|
-
|
|
48
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
|
80
|
+
def characters(number: 255, min_alpha: 0, min_numeric: 0)
|
|
81
|
+
Faker::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
|
-
paragraph +=
|
|
195
|
+
paragraph += " #{paragraph(sentence_count: 3, supplemental: supplemental)}" while paragraph.length < number
|
|
111
196
|
|
|
112
|
-
paragraph[0...number - 1]
|
|
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
|
|
|
@@ -129,7 +96,7 @@ module Faker
|
|
|
129
96
|
private
|
|
130
97
|
|
|
131
98
|
def build_url(size, format, search_terms, match_all)
|
|
132
|
-
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~
|
|
99
|
+
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\A[0-9]+x[0-9]+\z/
|
|
133
100
|
|
|
134
101
|
url_parts = ['https://loremflickr.com']
|
|
135
102
|
url_parts << format
|
|
@@ -13,7 +13,7 @@ module Faker
|
|
|
13
13
|
#
|
|
14
14
|
# @faker.version 1.8.0
|
|
15
15
|
def headers
|
|
16
|
-
"#{fetch('markdown.headers')} #{Lorem.word.capitalize}"
|
|
16
|
+
"#{fetch('markdown.headers')} #{Faker::Lorem.word.capitalize}"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
##
|
|
@@ -27,8 +27,8 @@ 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
|
|
31
|
-
position = rand(0..words.length - 1)
|
|
30
|
+
words = paragraph.split
|
|
31
|
+
position = rand(0..(words.length - 1))
|
|
32
32
|
formatting = fetch('markdown.emphasis')
|
|
33
33
|
words[position] = "#{formatting}#{words[position]}#{formatting}"
|
|
34
34
|
words.join(' ')
|
|
@@ -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
|
##
|
|
@@ -95,7 +95,7 @@ module Faker
|
|
|
95
95
|
#
|
|
96
96
|
# @faker.version 1.8.0
|
|
97
97
|
def block_code
|
|
98
|
-
"```ruby\n#{Lorem.sentence(word_count: 1)}\n```"
|
|
98
|
+
"```ruby\n#{Faker::Lorem.sentence(word_count: 1)}\n```"
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
##
|
|
@@ -110,16 +110,18 @@ module Faker
|
|
|
110
110
|
def table
|
|
111
111
|
table = []
|
|
112
112
|
3.times do
|
|
113
|
-
table << "#{Lorem.word} | #{Lorem.word} | #{Lorem.word}"
|
|
113
|
+
table << "#{Faker::Lorem.word} | #{Faker::Lorem.word} | #{Faker::Lorem.word}"
|
|
114
114
|
end
|
|
115
115
|
table.insert(1, '---- | ---- | ----')
|
|
116
116
|
table.join("\n")
|
|
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
|
|
|
@@ -172,9 +140,10 @@ module Faker
|
|
|
172
140
|
|
|
173
141
|
def define_measurement_locale(amount, locale)
|
|
174
142
|
ensure_valid_amount(amount)
|
|
175
|
-
|
|
143
|
+
case amount
|
|
144
|
+
when ALL
|
|
176
145
|
make_plural(fetch("measurement.#{locale}"))
|
|
177
|
-
|
|
146
|
+
when NONE
|
|
178
147
|
fetch("measurement.#{locale}")
|
|
179
148
|
else
|
|
180
149
|
locale = check_for_plural(fetch("measurement.#{locale}"), amount)
|