faker 2.2.0 → 3.2.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 +1298 -24
- data/History.md +5 -5
- data/README.md +239 -104
- data/lib/faker/blockchain/aeternity.rb +70 -0
- data/lib/faker/blockchain/bitcoin.rb +28 -2
- data/lib/faker/blockchain/ethereum.rb +11 -1
- data/lib/faker/blockchain/tezos.rb +93 -9
- data/lib/faker/books/book.rb +36 -0
- data/lib/faker/books/culture_series.rb +49 -0
- data/lib/faker/books/dune.rb +73 -17
- data/lib/faker/books/lovecraft.rb +186 -57
- data/lib/faker/books/the_kingkiller_chronicle.rb +61 -0
- data/lib/faker/creature/animal.rb +9 -0
- data/lib/faker/creature/bird.rb +203 -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 +253 -33
- data/lib/faker/default/adjective.rb +35 -0
- data/lib/faker/default/alphanumeric.rb +27 -22
- data/lib/faker/default/ancient.rb +36 -0
- data/lib/faker/default/app.rb +46 -16
- data/lib/faker/default/appliance.rb +18 -0
- data/lib/faker/default/artist.rb +9 -0
- data/lib/faker/default/avatar.rb +32 -24
- data/lib/faker/default/bank.rb +118 -29
- data/lib/faker/default/barcode.rb +165 -0
- data/lib/faker/default/beer.rb +75 -3
- data/lib/faker/default/blood.rb +48 -0
- data/lib/faker/default/boolean.rb +13 -6
- data/lib/faker/default/bossa_nova.rb +18 -0
- data/lib/faker/default/business.rb +27 -0
- data/lib/faker/default/camera.rb +46 -0
- data/lib/faker/default/cannabis.rb +90 -0
- data/lib/faker/default/chile_rut.rb +62 -26
- data/lib/faker/default/chuck_norris.rb +13 -2
- data/lib/faker/default/code.rb +162 -58
- data/lib/faker/default/coffee.rb +45 -0
- data/lib/faker/default/coin.rb +18 -0
- data/lib/faker/default/color.rb +123 -5
- data/lib/faker/default/commerce.rb +105 -37
- data/lib/faker/default/company.rb +446 -34
- data/lib/faker/default/compass.rb +135 -0
- data/lib/faker/default/computer.rb +63 -0
- data/lib/faker/default/construction.rb +54 -0
- data/lib/faker/default/cosmere.rb +90 -0
- data/lib/faker/default/crypto.rb +44 -4
- data/lib/faker/default/crypto_coin.rb +48 -18
- data/lib/faker/default/currency.rb +27 -0
- data/lib/faker/default/date.rb +149 -52
- data/lib/faker/default/dc_comics.rb +45 -0
- data/lib/faker/default/demographic.rb +58 -6
- data/lib/faker/default/dessert.rb +27 -0
- data/lib/faker/default/device.rb +54 -0
- data/lib/faker/default/driving_licence.rb +85 -28
- data/lib/faker/default/drone.rb +332 -0
- data/lib/faker/default/educator.rb +73 -6
- data/lib/faker/default/electrical_components.rb +27 -0
- data/lib/faker/default/emotion.rb +33 -0
- data/lib/faker/default/esport.rb +45 -0
- data/lib/faker/default/file.rb +53 -38
- data/lib/faker/default/finance.rb +75 -8
- data/lib/faker/default/food.rb +93 -3
- data/lib/faker/default/funny_name.rb +45 -0
- data/lib/faker/default/gender.rb +31 -0
- data/lib/faker/default/greek_philosophers.rb +18 -0
- data/lib/faker/default/hacker.rb +59 -1
- data/lib/faker/default/hipster.rb +106 -81
- data/lib/faker/default/hobby.rb +22 -0
- data/lib/faker/default/house.rb +18 -0
- data/lib/faker/default/html.rb +230 -0
- data/lib/faker/default/id_number.rb +276 -18
- data/lib/faker/default/industry_segments.rb +36 -0
- data/lib/faker/default/internet.rb +442 -147
- data/lib/faker/default/internet_http.rb +48 -0
- data/lib/faker/default/invoice.rb +37 -29
- data/lib/faker/default/job.rb +36 -0
- data/lib/faker/default/json.rb +61 -30
- data/lib/faker/default/kpop.rb +54 -0
- data/lib/faker/default/lorem.rb +184 -121
- data/lib/faker/default/lorem_flickr.rb +69 -68
- data/lib/faker/default/markdown.rb +97 -15
- data/lib/faker/default/marketing.rb +9 -0
- data/lib/faker/default/measurement.rb +101 -50
- data/lib/faker/default/military.rb +71 -0
- data/lib/faker/default/mountain.rb +33 -0
- data/lib/faker/default/name.rb +99 -6
- data/lib/faker/default/nation.rb +45 -5
- data/lib/faker/default/nato_phonetic_alphabet.rb +9 -0
- data/lib/faker/default/nhs.rb +21 -7
- data/lib/faker/default/number.rb +160 -91
- data/lib/faker/default/omniauth.rb +199 -137
- data/lib/faker/default/phone_number.rb +89 -11
- data/lib/faker/default/placeholdit.rb +23 -25
- data/lib/faker/default/programming_language.rb +18 -0
- data/lib/faker/default/relationship.rb +47 -7
- data/lib/faker/default/religion.rb +6 -0
- data/lib/faker/default/restaurant.rb +54 -2
- data/lib/faker/default/science.rb +135 -0
- data/lib/faker/default/slack_emoji.rb +81 -0
- data/lib/faker/default/source.rb +46 -22
- data/lib/faker/default/south_africa.rb +90 -0
- data/lib/faker/default/space.rb +128 -1
- data/lib/faker/default/string.rb +18 -9
- data/lib/faker/default/stripe.rb +68 -27
- data/lib/faker/default/subscription.rb +45 -0
- data/lib/faker/default/superhero.rb +45 -0
- data/lib/faker/default/tea.rb +41 -0
- data/lib/faker/default/team.rb +45 -0
- data/lib/faker/default/time.rb +84 -68
- data/lib/faker/default/twitter.rb +57 -47
- data/lib/faker/default/types.rb +90 -41
- data/lib/faker/default/university.rb +45 -0
- data/lib/faker/default/vehicle.rb +223 -60
- data/lib/faker/default/verb.rb +45 -0
- data/lib/faker/default/vulnerability_identifier.rb +23 -0
- data/lib/faker/default/world_cup.rb +52 -16
- data/lib/faker/fantasy/tolkien.rb +67 -0
- data/lib/faker/games/clash_of_clans.rb +48 -0
- data/lib/faker/games/control.rb +113 -0
- data/lib/faker/games/dnd.rb +178 -0
- data/lib/faker/games/dota.rb +61 -6
- data/lib/faker/games/elder_scrolls.rb +98 -0
- data/lib/faker/games/fallout.rb +37 -0
- data/lib/faker/games/final_fantasy_xiv.rb +73 -0
- data/lib/faker/games/game.rb +27 -0
- data/lib/faker/games/half_life.rb +27 -0
- data/lib/faker/games/heroes.rb +40 -0
- data/lib/faker/games/heroes_of_the_storm.rb +48 -1
- data/lib/faker/games/league_of_legends.rb +54 -0
- data/lib/faker/games/minecraft.rb +113 -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/street_fighter.rb +61 -0
- data/lib/faker/games/super_mario.rb +48 -0
- data/lib/faker/games/super_smash_bros.rb +18 -0
- data/lib/faker/games/tarkov.rb +205 -0
- data/lib/faker/games/touhou.rb +75 -0
- data/lib/faker/games/warhammer_fantasy.rb +74 -0
- data/lib/faker/games/witcher.rb +93 -0
- data/lib/faker/games/world_of_warcraft.rb +44 -1
- data/lib/faker/games/zelda.rb +37 -1
- 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 +35 -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 +55 -1
- data/lib/faker/japanese_media/studio_ghibli.rb +48 -0
- data/lib/faker/japanese_media/sword_art_online.rb +36 -0
- data/lib/faker/locations/australia.rb +47 -0
- data/lib/faker/movies/avatar.rb +49 -0
- data/lib/faker/movies/back_to_the_future.rb +28 -0
- data/lib/faker/movies/departed.rb +49 -0
- data/lib/faker/movies/ghostbusters.rb +28 -0
- data/lib/faker/movies/hackers.rb +48 -0
- data/lib/faker/movies/harry_potter.rb +54 -0
- data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
- data/lib/faker/movies/hobbit.rb +41 -4
- data/lib/faker/movies/how_to_train_your_dragon.rb +48 -0
- data/lib/faker/movies/lebowski.rb +27 -0
- data/lib/faker/movies/lord_of_the_rings.rb +31 -3
- data/lib/faker/movies/movie.rb +22 -0
- data/lib/faker/movies/princess_bride.rb +19 -0
- data/lib/faker/movies/room.rb +63 -0
- data/lib/faker/movies/star_wars.rb +170 -11
- data/lib/faker/movies/tron.rb +161 -0
- data/lib/faker/movies/v_for_vendetta.rb +29 -0
- data/lib/faker/music/grateful_dead.rb +18 -0
- data/lib/faker/music/hiphop.rb +48 -0
- data/lib/faker/music/music.rb +102 -4
- data/lib/faker/music/opera.rb +273 -1
- data/lib/faker/music/pearl_jam.rb +50 -0
- data/lib/faker/music/phish.rb +36 -1
- data/lib/faker/music/prince.rb +64 -0
- data/lib/faker/music/rock_band.rb +21 -0
- data/lib/faker/music/rush.rb +37 -0
- data/lib/faker/music/show.rb +49 -0
- data/lib/faker/music/smashing_pumpkins.rb +64 -0
- data/lib/faker/music/umphreys_mcgee.rb +9 -0
- data/lib/faker/quotes/chiquito.rb +80 -0
- data/lib/faker/quotes/quote.rb +93 -1
- data/lib/faker/quotes/rajnikanth.rb +27 -0
- data/lib/faker/quotes/shakespeare.rb +70 -0
- data/lib/faker/religion/bible.rb +50 -0
- data/lib/faker/sports/basketball.rb +36 -0
- data/lib/faker/sports/chess.rb +90 -0
- data/lib/faker/sports/football.rb +45 -0
- data/lib/faker/sports/mountaineering.rb +22 -0
- data/lib/faker/sports/sport.rb +116 -0
- data/lib/faker/sports/volleyball.rb +74 -0
- data/lib/faker/travel/airport.rb +43 -0
- data/lib/faker/travel/train_station.rb +54 -0
- data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +22 -0
- data/lib/faker/tv_shows/archer.rb +51 -0
- data/lib/faker/tv_shows/big_bang_theory.rb +37 -0
- data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
- data/lib/faker/tv_shows/breaking_bad.rb +18 -0
- data/lib/faker/tv_shows/brooklyn_nine_nine.rb +38 -0
- data/lib/faker/tv_shows/buffy.rb +60 -2
- data/lib/faker/tv_shows/community.rb +19 -0
- data/lib/faker/tv_shows/dr_who.rb +78 -2
- data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
- data/lib/faker/tv_shows/family_guy.rb +28 -0
- data/lib/faker/tv_shows/final_space.rb +51 -0
- data/lib/faker/tv_shows/friends.rb +27 -0
- data/lib/faker/tv_shows/futurama.rb +65 -0
- data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
- data/lib/faker/tv_shows/hey_arnold.rb +27 -0
- data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
- data/lib/faker/tv_shows/michael_scott.rb +10 -0
- data/lib/faker/tv_shows/new_girl.rb +19 -0
- data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
- data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
- data/lib/faker/tv_shows/ru_paul.rb +18 -0
- data/lib/faker/tv_shows/seinfeld.rb +28 -0
- data/lib/faker/tv_shows/silicon_valley.rb +75 -0
- data/lib/faker/tv_shows/simpsons.rb +42 -0
- data/lib/faker/tv_shows/south_park.rb +34 -0
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/tv_shows/star_trek.rb +36 -0
- data/lib/faker/tv_shows/stargate.rb +28 -0
- data/lib/faker/tv_shows/stranger_things.rb +19 -0
- data/lib/faker/tv_shows/suits.rb +37 -0
- data/lib/faker/tv_shows/supernatural.rb +48 -0
- data/lib/faker/tv_shows/the_expanse.rb +36 -0
- data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +43 -2
- data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
- data/lib/faker/tv_shows/the_office.rb +37 -0
- data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
- data/lib/faker/tv_shows/twin_peaks.rb +28 -0
- data/lib/faker/tv_shows/venture_bros.rb +38 -0
- data/lib/faker/version.rb +2 -2
- data/lib/faker.rb +58 -58
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/char.rb +22 -27
- data/lib/helpers/positional_generator.rb +480 -0
- data/lib/helpers/unique_generator.rb +17 -13
- data/lib/locales/README.md +18 -2
- data/lib/locales/ar.yml +6 -1
- data/lib/locales/bg.yml +3 -3
- data/lib/locales/ca.yml +0 -8
- data/lib/locales/da-DK.yml +6 -4
- data/lib/locales/de-AT.yml +7 -6
- data/lib/locales/de-CH.yml +6028 -9
- data/lib/locales/de.yml +12 -6
- data/lib/locales/en/address.yml +8 -3
- data/lib/locales/en/adjective.yml +179 -0
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/animal.yml +1 -1
- data/lib/locales/en/aqua_teen_hunger_force.yml +33 -1
- data/lib/locales/en/archer.yml +75 -0
- data/lib/locales/en/australia.yml +107 -0
- data/lib/locales/en/avatar.yml +31 -0
- data/lib/locales/en/bank.yml +1 -1
- data/lib/locales/en/barcode.yml +24 -0
- data/lib/locales/en/bible.yml +90 -0
- data/lib/locales/en/big_bang_theory.yml +38 -0
- data/lib/locales/en/bird.yml +1281 -0
- data/lib/locales/en/blood.yml +13 -0
- data/lib/locales/en/book.yml +487 -3
- data/lib/locales/en/brooklyn_nine_nine.yml +35 -0
- data/lib/locales/en/buffy.yml +1 -1
- data/lib/locales/en/camera.yml +611 -0
- data/lib/locales/en/cat.yml +1 -1
- data/lib/locales/en/chess.yml +103 -0
- data/lib/locales/en/chiquito.yml +64 -0
- data/lib/locales/en/clash_of_clan.yml +101 -0
- data/lib/locales/en/coffee.yml +1 -1
- data/lib/locales/en/color.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 +3 -2
- data/lib/locales/en/computer.yml +55 -0
- data/lib/locales/en/conan.yml +171 -0
- data/lib/locales/en/control.yml +247 -0
- data/lib/locales/en/cowboy_bebop.yml +163 -0
- data/lib/locales/en/demographic.yml +218 -5
- data/lib/locales/en/departed.yml +50 -0
- data/lib/locales/en/device.yml +112 -4
- data/lib/locales/en/dnd.yml +636 -0
- data/lib/locales/en/doraemon.yml +286 -0
- data/lib/locales/en/dota.yml +651 -63
- data/lib/locales/en/dr_who.yml +1 -1
- 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/dune.yml +270 -131
- data/lib/locales/en/educator.yml +75 -6
- data/lib/locales/en/elder_scrolls.yml +583 -9
- data/lib/locales/en/emotion.yml +480 -0
- data/lib/locales/en/fallout.yml +311 -133
- data/lib/locales/en/file.yml +9 -1
- data/lib/locales/en/final_fantasy_xiv.yml +754 -0
- data/lib/locales/en/final_space.yml +37 -0
- data/lib/locales/en/finance.yml +77 -1
- data/lib/locales/en/fma_brotherhood.yml +78 -0
- data/lib/locales/en/food.yml +1066 -10
- data/lib/locales/en/football.yml +3 -3
- data/lib/locales/en/fresh_prince_of_bel_air.yml +1 -1
- data/lib/locales/en/futurama.yml +344 -0
- data/lib/locales/en/game.yml +11 -0
- data/lib/locales/en/gender.yml +1 -0
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/half_life.yml +84 -3
- data/lib/locales/en/heroes.yml +408 -3
- data/lib/locales/en/heroes_of_the_storm.yml +131 -4
- data/lib/locales/en/hobby.yml +171 -0
- data/lib/locales/en/horse.yml +2 -2
- data/lib/locales/en/house.yml +1 -1
- data/lib/locales/en/how_to_train_your_dragon.yml +174 -0
- data/lib/locales/en/internet.yml +140 -3
- data/lib/locales/en/jack_handey.yml +54 -0
- data/lib/locales/en/kamen_rider.yml +452 -0
- data/lib/locales/en/kpop.yml +7 -7
- data/lib/locales/en/league_of_legends.yml +285 -6
- data/lib/locales/en/lebowski.yml +1 -1
- data/lib/locales/en/lovecraft.yml +76 -6
- data/lib/locales/en/military.yml +179 -5
- data/lib/locales/en/minecraft.yml +663 -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 +194 -2
- data/lib/locales/en/music.yml +461 -29
- data/lib/locales/en/myst.yml +87 -31
- data/lib/locales/en/name.yml +6 -5
- data/lib/locales/en/naruto.yml +230 -0
- data/lib/locales/en/one_piece.yml +2 -2
- data/lib/locales/en/opera.yml +169 -1
- data/lib/locales/en/overwatch.yml +2648 -37
- data/lib/locales/en/pearl_jam.yml +213 -0
- data/lib/locales/en/phish.yml +392 -1
- data/lib/locales/en/phone_number.yml +1 -1
- data/lib/locales/en/pokemon.yml +417 -4
- data/lib/locales/en/prince.yml +227 -0
- data/lib/locales/en/quote.yml +692 -163
- data/lib/locales/en/rajnikanth.yml +77 -0
- data/lib/locales/en/rock_band.yml +1 -0
- data/lib/locales/en/room.yml +68 -0
- data/lib/locales/en/rush.yml +32 -0
- data/lib/locales/en/science.yml +481 -3
- data/lib/locales/en/shakespeare.yml +23 -26
- data/lib/locales/en/show.yml +597 -0
- data/lib/locales/en/simpsons.yml +668 -0
- 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 +1 -1
- data/lib/locales/en/spongebob.yml +489 -0
- data/lib/locales/en/sport.yml +130 -0
- data/lib/locales/en/star_trek.yml +1 -1
- data/lib/locales/en/star_wars.yml +568 -220
- data/lib/locales/en/stranger_thing.yml +1 -1
- data/lib/locales/en/street_fighter.yml +1524 -0
- data/lib/locales/en/stripe.yml +3 -3
- data/lib/locales/en/studio_ghibli.yml +107 -0
- data/lib/locales/en/suits.yml +45 -0
- data/lib/locales/en/super_mario.yml +58 -0
- data/lib/locales/en/super_smash_bros.yml +23 -5
- 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/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/vehicle.yml +2809 -75
- data/lib/locales/en/volleyball.yml +501 -0
- data/lib/locales/en/warhammer_fantasy.yml +582 -0
- data/lib/locales/en/witcher.yml +426 -7
- data/lib/locales/en/world_of_warcraft.yml +122 -4
- data/lib/locales/en/zelda.yml +962 -4
- data/lib/locales/en-AU.yml +50 -10
- data/lib/locales/en-CA.yml +5 -1
- data/lib/locales/en-GB.yml +3 -2
- data/lib/locales/en-IND.yml +2 -1
- data/lib/locales/en-MS.yml +3 -1
- data/lib/locales/en-NEP.yml +5 -2
- data/lib/locales/en-NG.yml +1 -0
- data/lib/locales/en-NZ.yml +135 -8
- data/lib/locales/en-PAK.yml +3 -1
- data/lib/locales/en-SG.yml +3 -1
- data/lib/locales/en-TH.yml +360 -0
- data/lib/locales/en-UG.yml +1 -0
- data/lib/locales/en-US.yml +38 -12
- data/lib/locales/en-ZA.yml +2 -2
- data/lib/locales/en-au-ocker.yml +4 -1
- data/lib/locales/en.yml +0 -3
- data/lib/locales/es-AR.yml +4601 -0
- data/lib/locales/es-MX.yml +4 -1
- data/lib/locales/es.yml +58 -2
- data/lib/locales/fa.yml +2 -0
- data/lib/locales/fi-FI.yml +4 -2
- 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 +5 -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 +28 -11
- data/lib/locales/fr-CH.yml +3 -3
- data/lib/locales/fr.yml +1 -112
- data/lib/locales/hy.yml +3 -7
- data/lib/locales/id.yml +5 -2
- data/lib/locales/it.yml +3 -1
- 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/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 +95 -2
- data/lib/locales/lt.yml +34 -0
- data/lib/locales/lv.yml +1 -1
- data/lib/locales/mi-NZ.yml +283 -0
- data/lib/locales/nb-NO.yml +5 -2
- data/lib/locales/nl.yml +1 -0
- data/lib/locales/pl.yml +2 -2
- data/lib/locales/pt-BR.yml +33 -4
- data/lib/locales/pt.yml +6 -4
- data/lib/locales/ru.yml +43 -1
- data/lib/locales/sk.yml +5 -2
- data/lib/locales/sv.yml +1 -0
- data/lib/locales/th.yml +380 -0
- data/lib/locales/tr.yml +1 -0
- data/lib/locales/uk.yml +10 -5
- data/lib/locales/vi.yml +1 -0
- data/lib/locales/zh-CN/bank.yml +17 -0
- data/lib/locales/zh-CN.yml +2 -1
- data/lib/locales/zh-TW.yml +2 -1
- metadata +201 -109
- data/lib/faker/default/fillmurray.rb +0 -30
- data/lib/faker/default/lorem_pixel.rb +0 -63
- data/lib/locales/en/hobbit.yml +0 -19
- data/lib/locales/en/lord_of_the_rings.yml +0 -6
- data/lib/locales/ja.yml +0 -98
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
class TvShows
|
|
5
|
+
class TheOffice < Base
|
|
6
|
+
flexible :the_office
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
##
|
|
10
|
+
# Produces a character from The Office.
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# Faker::TvShows::TheOffice.character #=> "Michael Scott"
|
|
16
|
+
#
|
|
17
|
+
# @faker.version next
|
|
18
|
+
def character
|
|
19
|
+
fetch('the_office.characters')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Produces a quote from The Office.
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
#
|
|
27
|
+
# @example
|
|
28
|
+
# Faker::TvShows::TheOffice.quote #=> "Identity theft is not a joke, Jim! Millions of families suffer every year."
|
|
29
|
+
#
|
|
30
|
+
# @faker.version next
|
|
31
|
+
def quote
|
|
32
|
+
fetch('the_office.quotes')
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -6,14 +6,42 @@ module Faker
|
|
|
6
6
|
flexible :the_thick_of_it
|
|
7
7
|
|
|
8
8
|
class << self
|
|
9
|
+
##
|
|
10
|
+
# Produces a character from The Thick of It.
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# Faker::TvShows::TheThickOfIt.character #=> "Nicola Murray"
|
|
16
|
+
#
|
|
17
|
+
# @faker.version 1.8.5
|
|
9
18
|
def character
|
|
10
19
|
fetch('the_thick_of_it.characters')
|
|
11
20
|
end
|
|
12
21
|
|
|
22
|
+
##
|
|
23
|
+
# Produces a department from The Thick of It.
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
#
|
|
27
|
+
# @example
|
|
28
|
+
# Faker::TvShows::TheThickOfIt.department #=> "Shadow Cabinet"
|
|
29
|
+
#
|
|
30
|
+
# @faker.version 1.8.5
|
|
13
31
|
def department
|
|
14
32
|
fetch('the_thick_of_it.departments')
|
|
15
33
|
end
|
|
16
34
|
|
|
35
|
+
##
|
|
36
|
+
# Produces a position from The Thick of It.
|
|
37
|
+
#
|
|
38
|
+
# @return [String]
|
|
39
|
+
#
|
|
40
|
+
# @example
|
|
41
|
+
# Faker::TvShows::TheThickOfIt.position
|
|
42
|
+
# #=> "Director of Communications"
|
|
43
|
+
#
|
|
44
|
+
# @faker.version 1.8.5
|
|
17
45
|
def position
|
|
18
46
|
fetch('the_thick_of_it.positions')
|
|
19
47
|
end
|
|
@@ -6,14 +6,42 @@ module Faker
|
|
|
6
6
|
flexible :twin_peaks
|
|
7
7
|
|
|
8
8
|
class << self
|
|
9
|
+
##
|
|
10
|
+
# Produces a character from Twin Peaks.
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# Faker::TvShows::TwinPeaks.character #=> "Dale Cooper"
|
|
16
|
+
#
|
|
17
|
+
# @faker.version 1.7.0
|
|
9
18
|
def character
|
|
10
19
|
fetch('twin_peaks.characters')
|
|
11
20
|
end
|
|
12
21
|
|
|
22
|
+
##
|
|
23
|
+
# Produces a location from Twin Peaks.
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
#
|
|
27
|
+
# @example
|
|
28
|
+
# Faker::TvShows::TwinPeaks.location #=> "Black Lodge"
|
|
29
|
+
#
|
|
30
|
+
# @faker.version 1.7.0
|
|
13
31
|
def location
|
|
14
32
|
fetch('twin_peaks.locations')
|
|
15
33
|
end
|
|
16
34
|
|
|
35
|
+
##
|
|
36
|
+
# Produces a quote from Twin Peaks.
|
|
37
|
+
#
|
|
38
|
+
# @return [String]
|
|
39
|
+
#
|
|
40
|
+
# @example
|
|
41
|
+
# Faker::TvShows::TwinPeaks.quote
|
|
42
|
+
# #=> "The owls are not what they seem."
|
|
43
|
+
#
|
|
44
|
+
# @faker.version 1.7.0
|
|
17
45
|
def quote
|
|
18
46
|
fetch('twin_peaks.quotes')
|
|
19
47
|
end
|
|
@@ -6,18 +6,56 @@ module Faker
|
|
|
6
6
|
flexible :venture_bros
|
|
7
7
|
|
|
8
8
|
class << self
|
|
9
|
+
##
|
|
10
|
+
# Produces a character from The Venture Bros.
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# Faker::TvShows::VentureBros.character #=> "Scaramantula"
|
|
16
|
+
#
|
|
17
|
+
# @faker.version 1.8.3
|
|
9
18
|
def character
|
|
10
19
|
fetch('venture_bros.character')
|
|
11
20
|
end
|
|
12
21
|
|
|
22
|
+
##
|
|
23
|
+
# Produces an organization from The Venture Bros.
|
|
24
|
+
#
|
|
25
|
+
# @return [String]
|
|
26
|
+
#
|
|
27
|
+
# @example
|
|
28
|
+
# Faker::TvShows::VentureBros.organization
|
|
29
|
+
# #=> "Guild of Calamitous Intent"
|
|
30
|
+
#
|
|
31
|
+
# @faker.version 1.8.3
|
|
13
32
|
def organization
|
|
14
33
|
fetch('venture_bros.organization')
|
|
15
34
|
end
|
|
16
35
|
|
|
36
|
+
##
|
|
37
|
+
# Produces a vehicle from The Venture Bros.
|
|
38
|
+
#
|
|
39
|
+
# @return [String]
|
|
40
|
+
#
|
|
41
|
+
# @example
|
|
42
|
+
# Faker::TvShows::VentureBros.vehicle #=> "Monarchmobile"
|
|
43
|
+
#
|
|
44
|
+
# @faker.version 1.8.3
|
|
17
45
|
def vehicle
|
|
18
46
|
fetch('venture_bros.vehicle')
|
|
19
47
|
end
|
|
20
48
|
|
|
49
|
+
##
|
|
50
|
+
# Produces a quote from The Venture Bros.
|
|
51
|
+
#
|
|
52
|
+
# @return [String]
|
|
53
|
+
#
|
|
54
|
+
# @example
|
|
55
|
+
# Faker::TvShows::VentureBros.quote
|
|
56
|
+
# #=> "Revenge, like gazpacho soup, is best served cold, precise, and merciless."
|
|
57
|
+
#
|
|
58
|
+
# @faker.version 1.8.3
|
|
21
59
|
def quote
|
|
22
60
|
fetch('venture_bros.quote')
|
|
23
61
|
end
|
data/lib/faker/version.rb
CHANGED
data/lib/faker.rb
CHANGED
|
@@ -2,37 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
mydir = __dir__
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require 'psych'
|
|
7
|
-
end
|
|
8
|
-
|
|
5
|
+
require 'psych'
|
|
9
6
|
require 'i18n'
|
|
10
|
-
require 'set' # Fixes a bug in i18n 0.6.11
|
|
11
7
|
|
|
12
|
-
Dir.glob(File.join(
|
|
8
|
+
Dir.glob(File.join(mydir, 'helpers', '*.rb')).sort.each { |file| require file }
|
|
13
9
|
|
|
14
10
|
I18n.load_path += Dir[File.join(mydir, 'locales', '**/*.yml')]
|
|
15
|
-
I18n.reload! if I18n.backend.initialized?
|
|
16
11
|
|
|
17
12
|
module Faker
|
|
18
|
-
|
|
19
|
-
@
|
|
20
|
-
@random = nil
|
|
13
|
+
module Config
|
|
14
|
+
@default_locale = nil
|
|
21
15
|
|
|
22
16
|
class << self
|
|
23
|
-
attr_writer :
|
|
24
|
-
|
|
17
|
+
attr_writer :default_locale
|
|
18
|
+
|
|
19
|
+
def locale=(new_locale)
|
|
20
|
+
Thread.current[:faker_config_locale] = new_locale
|
|
21
|
+
end
|
|
25
22
|
|
|
26
23
|
def locale
|
|
27
|
-
|
|
24
|
+
# Because I18n.locale defaults to :en, if we don't have :en in our available_locales, errors will happen
|
|
25
|
+
Thread.current[:faker_config_locale] || @default_locale || (I18n.available_locales.include?(I18n.locale) ? I18n.locale : I18n.available_locales.first)
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
def own_locale
|
|
31
|
-
|
|
29
|
+
Thread.current[:faker_config_locale]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def random=(new_random)
|
|
33
|
+
Thread.current[:faker_config_random] = new_random
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def random
|
|
35
|
-
|
|
37
|
+
Thread.current[:faker_config_random] || Random
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
end
|
|
@@ -44,23 +46,29 @@ module Faker
|
|
|
44
46
|
Letters = ULetters + LLetters
|
|
45
47
|
|
|
46
48
|
class << self
|
|
49
|
+
attr_reader :flexible_key
|
|
50
|
+
|
|
47
51
|
NOT_GIVEN = Object.new
|
|
48
52
|
|
|
49
53
|
## by default numerify results do not start with a zero
|
|
50
54
|
def numerify(number_string, leading_zero: false)
|
|
51
|
-
return number_string.gsub(
|
|
55
|
+
return number_string.gsub('#') { rand(10).to_s } if leading_zero
|
|
52
56
|
|
|
53
|
-
number_string.sub(
|
|
57
|
+
number_string.sub('#') { rand(1..9).to_s }.gsub('#') { rand(10).to_s }
|
|
54
58
|
end
|
|
55
59
|
|
|
56
60
|
def letterify(letter_string)
|
|
57
|
-
letter_string.gsub(
|
|
61
|
+
letter_string.gsub('?') { sample(ULetters) }
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
def bothify(string)
|
|
61
65
|
letterify(numerify(string))
|
|
62
66
|
end
|
|
63
67
|
|
|
68
|
+
def generate(as_type, &block)
|
|
69
|
+
PositionalGenerator.new(as_type, &block).generate
|
|
70
|
+
end
|
|
71
|
+
|
|
64
72
|
# Given a regular expression, attempt to generate a string
|
|
65
73
|
# that would match it. This is a rather simple implementation,
|
|
66
74
|
# so don't be shocked if it blows up on you in a spectacular fashion.
|
|
@@ -83,14 +91,14 @@ module Faker
|
|
|
83
91
|
def regexify(reg)
|
|
84
92
|
reg = reg.source if reg.respond_to?(:source) # Handle either a Regexp or a String that looks like a Regexp
|
|
85
93
|
reg
|
|
86
|
-
.gsub(%r{
|
|
87
|
-
.gsub(/\{(\d+)\}/, '{\1,\1}').gsub(
|
|
94
|
+
.gsub(%r{^/?\^?}, '').gsub(%r{\$?/?$}, '') # Ditch the anchors
|
|
95
|
+
.gsub(/\{(\d+)\}/, '{\1,\1}').gsub('?', '{0,1}') # All {2} become {2,2} and ? become {0,1}
|
|
88
96
|
.gsub(/(\[[^\]]+\])\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # [12]{1,2} becomes [12] or [12][12]
|
|
89
|
-
.gsub(/(\([
|
|
97
|
+
.gsub(/(\([^)]+\))\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # (12|34){1,2} becomes (12|34) or (12|34)(12|34)
|
|
90
98
|
.gsub(/(\\?.)\{(\d+),(\d+)\}/) { |_match| Regexp.last_match(1) * sample(Array(Range.new(Regexp.last_match(2).to_i, Regexp.last_match(3).to_i))) } # A{1,2} becomes A or AA or \d{3} becomes \d\d\d
|
|
91
|
-
.gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[
|
|
92
|
-
.gsub(/\[([^\]]+)\]/) { |match| match.gsub(/(\w
|
|
93
|
-
.gsub(/\[([^\]]+)\]/) { |_match| sample(Regexp.last_match(1).
|
|
99
|
+
.gsub(/\((.*?)\)/) { |match| sample(match.gsub(/[()]/, '').split('|')) } # (this|that) becomes 'this' or 'that'
|
|
100
|
+
.gsub(/\[([^\]]+)\]/) { |match| match.gsub(/(\w-\w)/) { |range| sample(Array(Range.new(*range.split('-')))) } } # All A-Z inside of [] become C (or X, or whatever)
|
|
101
|
+
.gsub(/\[([^\]]+)\]/) { |_match| sample(Regexp.last_match(1).chars) } # All [ABC] become B (or A or C)
|
|
94
102
|
.gsub('\d') { |_match| sample(Numbers) }
|
|
95
103
|
.gsub('\w') { |_match| sample(Letters) }
|
|
96
104
|
end
|
|
@@ -99,7 +107,7 @@ module Faker
|
|
|
99
107
|
# with an array of values and selecting one of them.
|
|
100
108
|
def fetch(key)
|
|
101
109
|
fetched = sample(translate("faker.#{key}"))
|
|
102
|
-
if fetched&.match(%r{
|
|
110
|
+
if fetched&.match(%r{^/}) && fetched&.match(%r{/$}) # A regex
|
|
103
111
|
regexify(fetched)
|
|
104
112
|
else
|
|
105
113
|
fetched
|
|
@@ -111,7 +119,7 @@ module Faker
|
|
|
111
119
|
def fetch_all(key)
|
|
112
120
|
fetched = translate("faker.#{key}")
|
|
113
121
|
fetched = fetched.last if fetched.size <= 1
|
|
114
|
-
if !fetched.respond_to?(:sample) && fetched.match(%r{
|
|
122
|
+
if !fetched.respond_to?(:sample) && fetched.match(%r{^/}) && fetched.match(%r{/$}) # A regex
|
|
115
123
|
regexify(fetched)
|
|
116
124
|
else
|
|
117
125
|
fetched
|
|
@@ -123,7 +131,7 @@ module Faker
|
|
|
123
131
|
# formatted translation: e.g., "#{first_name} #{last_name}".
|
|
124
132
|
def parse(key)
|
|
125
133
|
fetched = fetch(key)
|
|
126
|
-
parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([
|
|
134
|
+
parts = fetched.scan(/(\(?)#\{([A-Za-z]+\.)?([^}]+)\}([^#]+)?/).map do |prefix, kls, meth, etc|
|
|
127
135
|
# If the token had a class Prefix (e.g., Name.first_name)
|
|
128
136
|
# grab the constant, otherwise use self
|
|
129
137
|
cls = kls ? Faker.const_get(kls.chop) : self
|
|
@@ -132,7 +140,7 @@ module Faker
|
|
|
132
140
|
# In either case the information will be retained for reconstruction of the string.
|
|
133
141
|
text = prefix
|
|
134
142
|
|
|
135
|
-
# If the class has the method, call it, otherwise fetch the
|
|
143
|
+
# If the class has the method, call it, otherwise fetch the translation
|
|
136
144
|
# (e.g., faker.phone_number.area_code)
|
|
137
145
|
text += if cls.respond_to?(meth)
|
|
138
146
|
cls.send(meth)
|
|
@@ -151,30 +159,28 @@ module Faker
|
|
|
151
159
|
|
|
152
160
|
# Call I18n.translate with our configured locale if no
|
|
153
161
|
# locale is specified
|
|
154
|
-
def translate(*args)
|
|
155
|
-
opts = args.last.is_a?(Hash) ? args.pop : {}
|
|
162
|
+
def translate(*args, **opts)
|
|
156
163
|
opts[:locale] ||= Faker::Config.locale
|
|
157
164
|
opts[:raise] = true
|
|
158
|
-
I18n.translate(*args
|
|
165
|
+
I18n.translate(*args, **opts)
|
|
159
166
|
rescue I18n::MissingTranslationData
|
|
160
|
-
opts = args.last.is_a?(Hash) ? args.pop : {}
|
|
161
167
|
opts[:locale] = :en
|
|
162
168
|
|
|
163
169
|
# Super-simple fallback -- fallback to en if the
|
|
164
170
|
# translation was missing. If the translation isn't
|
|
165
171
|
# in en either, then it will raise again.
|
|
166
172
|
disable_enforce_available_locales do
|
|
167
|
-
I18n.translate(*args
|
|
173
|
+
I18n.translate(*args, **opts)
|
|
168
174
|
end
|
|
169
175
|
end
|
|
170
176
|
|
|
171
177
|
# Executes block with given locale set.
|
|
172
|
-
def with_locale(tmp_locale = nil)
|
|
178
|
+
def with_locale(tmp_locale = nil, &block)
|
|
173
179
|
current_locale = Faker::Config.own_locale
|
|
174
180
|
Faker::Config.locale = tmp_locale
|
|
175
181
|
|
|
176
182
|
disable_enforce_available_locales do
|
|
177
|
-
I18n.with_locale(tmp_locale)
|
|
183
|
+
I18n.with_locale(tmp_locale, &block)
|
|
178
184
|
end
|
|
179
185
|
ensure
|
|
180
186
|
Faker::Config.locale = current_locale
|
|
@@ -190,9 +196,9 @@ module Faker
|
|
|
190
196
|
# girls_name: ["Alice", "Cheryl", "Tatiana"]
|
|
191
197
|
# Then you can call Faker::Name.girls_name and it will act like #first_name
|
|
192
198
|
def method_missing(mth, *args, &block)
|
|
193
|
-
super unless
|
|
199
|
+
super unless flexible_key
|
|
194
200
|
|
|
195
|
-
if (translation = translate("faker.#{
|
|
201
|
+
if (translation = translate("faker.#{flexible_key}.#{mth}"))
|
|
196
202
|
sample(translation)
|
|
197
203
|
else
|
|
198
204
|
super
|
|
@@ -219,12 +225,24 @@ module Faker
|
|
|
219
225
|
end
|
|
220
226
|
end
|
|
221
227
|
|
|
228
|
+
# Return unique values from the generator every time.
|
|
229
|
+
#
|
|
230
|
+
# @param max_retries [Integer] The max number of retries that should be done before giving up.
|
|
231
|
+
# @return [self]
|
|
222
232
|
def unique(max_retries = 10_000)
|
|
223
233
|
@unique ||= UniqueGenerator.new(self, max_retries)
|
|
224
234
|
end
|
|
225
235
|
|
|
226
|
-
def sample(list)
|
|
227
|
-
list.respond_to?(:sample)
|
|
236
|
+
def sample(list, num = nil)
|
|
237
|
+
if list.respond_to?(:sample)
|
|
238
|
+
if num
|
|
239
|
+
list.sample(num, random: Faker::Config.random)
|
|
240
|
+
else
|
|
241
|
+
list.sample(random: Faker::Config.random)
|
|
242
|
+
end
|
|
243
|
+
else
|
|
244
|
+
list
|
|
245
|
+
end
|
|
228
246
|
end
|
|
229
247
|
|
|
230
248
|
def shuffle(list)
|
|
@@ -248,27 +266,9 @@ module Faker
|
|
|
248
266
|
ensure
|
|
249
267
|
I18n.enforce_available_locales = old_enforce_available_locales
|
|
250
268
|
end
|
|
251
|
-
|
|
252
|
-
private
|
|
253
|
-
|
|
254
|
-
# Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower.
|
|
255
|
-
def warn_with_uplevel(message, uplevel: 1)
|
|
256
|
-
at = parse_caller(caller[uplevel]).join(':')
|
|
257
|
-
warn "#{at}: #{message}"
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
def parse_caller(at)
|
|
261
|
-
# rubocop:disable Style/GuardClause
|
|
262
|
-
if /^(.+?):(\d+)(?::in `.*')?/ =~ at
|
|
263
|
-
file = Regexp.last_match(1)
|
|
264
|
-
line = Regexp.last_match(2).to_i
|
|
265
|
-
[file, line]
|
|
266
|
-
end
|
|
267
|
-
# rubocop:enable Style/GuardClause
|
|
268
|
-
end
|
|
269
269
|
end
|
|
270
270
|
end
|
|
271
271
|
end
|
|
272
272
|
|
|
273
273
|
# require faker objects
|
|
274
|
-
Dir.glob(File.join(
|
|
274
|
+
Dir.glob(File.join(mydir, 'faker', '/**/*.rb')).sort.each { |file| require file }
|
data/lib/helpers/base58.rb
CHANGED
data/lib/helpers/char.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Faker
|
|
|
5
5
|
def self.prepare(string)
|
|
6
6
|
result = romanize_cyrillic string
|
|
7
7
|
result = fix_umlauts result
|
|
8
|
-
result.gsub(
|
|
8
|
+
result.gsub(/[^\w-]/, '').downcase
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def self.fix_umlauts(string)
|
|
@@ -15,6 +15,7 @@ module Faker
|
|
|
15
15
|
when 'ö' then 'oe'
|
|
16
16
|
when 'ü' then 'ue'
|
|
17
17
|
when 'ß' then 'ss'
|
|
18
|
+
else match.downcase
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
end
|
|
@@ -23,19 +24,16 @@ module Faker
|
|
|
23
24
|
if Faker::Config.locale == 'uk'
|
|
24
25
|
# Based on conventions abopted by BGN/PCGN for Ukrainian
|
|
25
26
|
uk_chars = {
|
|
26
|
-
'а' => 'a',
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'Ф' => 'f', 'Х' => 'kh', 'Ц' => 'ts', 'Ч' => 'ch', 'Ш' => 'sh', 'Щ' => 'shch',
|
|
37
|
-
'Ю' => 'yu', 'Я' => 'ya',
|
|
38
|
-
'ь' => '' # Ignore symbol, because its standard presentation is not allowed in URLs
|
|
27
|
+
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'h', 'ґ' => 'g', 'д' => 'd', 'е' => 'e',
|
|
28
|
+
'є' => 'ye', 'ж' => 'zh', 'з' => 'z', 'и' => 'y', 'і' => 'i', 'ї' => 'yi', 'й' => 'y',
|
|
29
|
+
'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
|
|
30
|
+
'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts', 'ч' => 'ch',
|
|
31
|
+
'ш' => 'sh', 'щ' => 'shch', 'ю' => 'yu', 'я' => 'ya', 'А' => 'a', 'Б' => 'b', 'В' => 'v',
|
|
32
|
+
'Г' => 'h', 'Ґ' => 'g', 'Д' => 'd', 'Е' => 'e', 'Є' => 'ye', 'Ж' => 'zh', 'З' => 'z',
|
|
33
|
+
'И' => 'y', 'І' => 'i', 'Ї' => 'yi', 'Й' => 'y', 'К' => 'k', 'Л' => 'l', 'М' => 'm',
|
|
34
|
+
'Н' => 'n', 'О' => 'o', 'П' => 'p', 'Р' => 'r', 'С' => 's', 'Т' => 't', 'У' => 'u',
|
|
35
|
+
'Ф' => 'f', 'Х' => 'kh', 'Ц' => 'ts', 'Ч' => 'ch', 'Ш' => 'sh', 'Щ' => 'shch', 'Ю' => 'yu',
|
|
36
|
+
'Я' => 'ya', 'ь' => '' # Ignore symbol, because its standard presentation is not allowed in URLs
|
|
39
37
|
}
|
|
40
38
|
return string.gsub(/[а-яА-ЯіїєґІЇЄҐ]/, uk_chars)
|
|
41
39
|
end
|
|
@@ -44,22 +42,19 @@ module Faker
|
|
|
44
42
|
# Based on conventions abopted by BGN/PCGN for Russian
|
|
45
43
|
ru_chars = {
|
|
46
44
|
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'h', 'д' => 'd', 'е' => 'e',
|
|
47
|
-
'ё' => 'ye', 'ж' => 'zh', 'з' => 'z',
|
|
48
|
-
'л' => 'l', 'м' => 'm', 'н' => 'n',
|
|
49
|
-
'с' => 's', 'т' => 't', 'у' => 'u',
|
|
50
|
-
'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'у',
|
|
51
|
-
'я' => 'ya',
|
|
52
|
-
'
|
|
53
|
-
'
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
'
|
|
57
|
-
'Я' => 'ya',
|
|
58
|
-
'ь' => '', 'ъ' => '' # Ignore symbols, because its standard presentation is not allowed in URLs
|
|
45
|
+
'ё' => 'ye', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'y', 'к' => 'k',
|
|
46
|
+
'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r',
|
|
47
|
+
'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts',
|
|
48
|
+
'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'у', 'э' => 'e', 'ю' => 'yu',
|
|
49
|
+
'я' => 'ya', 'А' => 'a', 'Б' => 'b', 'В' => 'v', 'Г' => 'h', 'Д' => 'd',
|
|
50
|
+
'Е' => 'e', 'Ё' => 'ye', 'Ж' => 'zh', 'З' => 'z', 'И' => 'i', 'Й' => 'y',
|
|
51
|
+
'К' => 'k', 'Л' => 'l', 'М' => 'm', 'Н' => 'n', 'О' => 'o', 'П' => 'p', 'Р' => 'r',
|
|
52
|
+
'С' => 's', 'Т' => 't', 'У' => 'u', 'Ф' => 'f', 'Х' => 'kh', 'Ц' => 'ts',
|
|
53
|
+
'Ч' => 'ch', 'Ш' => 'sh', 'Щ' => 'shch', 'Ы' => 'у', 'Э' => 'e', 'Ю' => 'yu',
|
|
54
|
+
'Я' => 'ya', 'ь' => '', 'ъ' => '' # Ignore symbols, because its standard presentation is not allowed in URLs
|
|
59
55
|
}
|
|
60
56
|
return string.gsub(/[а-яА-Я]/, ru_chars)
|
|
61
57
|
end
|
|
62
|
-
|
|
63
58
|
string
|
|
64
59
|
end
|
|
65
60
|
end
|