ffaker 2.10.0 → 2.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +217 -15
- data/Gemfile +17 -0
- data/README.md +43 -10
- data/REFERENCE.md +1681 -1241
- data/Rakefile +20 -55
- data/bin/console +9 -0
- data/ffaker.gemspec +17 -23
- data/lib/ffaker/address.rb +7 -7
- data/lib/ffaker/address_au.rb +8 -10
- data/lib/ffaker/address_br.rb +16 -4
- data/lib/ffaker/address_ca.rb +3 -3
- data/lib/ffaker/address_ch.rb +1 -3
- data/lib/ffaker/address_ch_de.rb +1 -3
- data/lib/ffaker/address_ch_fr.rb +1 -3
- data/lib/ffaker/address_ch_it.rb +1 -3
- data/lib/ffaker/address_da.rb +1 -3
- data/lib/ffaker/address_de.rb +1 -3
- data/lib/ffaker/address_fi.rb +1 -3
- data/lib/ffaker/address_fr.rb +9 -9
- data/lib/ffaker/address_gr.rb +1 -3
- data/lib/ffaker/address_id.rb +0 -3
- data/lib/ffaker/address_in.rb +5 -3
- data/lib/ffaker/address_it.rb +33 -0
- data/lib/ffaker/address_ja.rb +0 -3
- data/lib/ffaker/address_kr.rb +0 -1
- data/lib/ffaker/address_mx.rb +3 -471
- data/lib/ffaker/address_nl.rb +2 -6
- data/lib/ffaker/address_pl.rb +0 -2
- data/lib/ffaker/address_ru.rb +1 -3
- data/lib/ffaker/address_se.rb +1 -3
- data/lib/ffaker/address_sn.rb +1 -4
- data/lib/ffaker/address_ua.rb +3 -5
- data/lib/ffaker/address_uk.rb +1 -3
- data/lib/ffaker/address_us.rb +23 -5
- data/lib/ffaker/airline.rb +1 -1
- data/lib/ffaker/animal.rb +14 -0
- data/lib/ffaker/{animals.rb → animal_br.rb} +2 -2
- data/lib/ffaker/animal_cn.rb +12 -0
- data/lib/ffaker/animal_es.rb +12 -0
- data/lib/ffaker/animal_pl.rb +15 -0
- data/lib/ffaker/animal_us.rb +12 -0
- data/lib/ffaker/avatar.rb +32 -6
- data/lib/ffaker/aws.rb +1 -1
- data/lib/ffaker/bacon_ipsum.rb +1 -3
- data/lib/ffaker/bank.rb +118 -0
- data/lib/ffaker/bank_us.rb +33 -0
- data/lib/ffaker/book.rb +16 -8
- data/lib/ffaker/boolean.rb +1 -1
- data/lib/ffaker/cheesy_lingo.rb +5 -8
- data/lib/ffaker/code.rb +17 -1
- data/lib/ffaker/color.rb +7 -7
- data/lib/ffaker/color_pl.rb +14 -0
- data/lib/ffaker/color_ua.rb +1 -1
- data/lib/ffaker/company.rb +6 -9
- data/lib/ffaker/company_cn.rb +1 -1
- data/lib/ffaker/company_fr.rb +35 -0
- data/lib/ffaker/company_it.rb +4 -2
- data/lib/ffaker/company_ja.rb +24 -0
- data/lib/ffaker/company_se.rb +1 -1
- data/lib/ffaker/conference.rb +1 -1
- data/lib/ffaker/{courses.rb → courses_fr.rb} +3 -1
- data/lib/ffaker/crypto.rb +14 -0
- data/lib/ffaker/currency.rb +1 -1
- data/lib/ffaker/data/address/city_suffixes +1 -1
- data/lib/ffaker/data/address/country +1 -1
- data/lib/ffaker/data/address/country_code +1 -1
- data/lib/ffaker/data/address/neighborhood +1 -1
- data/lib/ffaker/data/address/street_suffix +1 -1
- data/lib/ffaker/data/address_br/city +0 -1
- data/lib/ffaker/data/address_br/complement +3 -0
- data/lib/ffaker/data/address_br/neighborhood_prefixes +3 -0
- data/lib/ffaker/data/address_br/state +1 -1
- data/lib/ffaker/data/address_ca/city +99 -99
- data/lib/ffaker/data/address_ca/province +1 -1
- data/lib/ffaker/data/address_de/city +1 -1
- data/lib/ffaker/data/address_de/state +2 -1
- data/lib/ffaker/data/address_fr/city +1 -1
- data/lib/ffaker/data/address_fr/region +27 -0
- data/lib/ffaker/data/address_gr/city +1 -1
- data/lib/ffaker/data/address_gr/region +1 -1
- data/lib/ffaker/data/address_gr/street +1 -1
- data/lib/ffaker/data/address_in/city +24 -0
- data/lib/ffaker/data/address_it/city +111 -0
- data/lib/ffaker/data/address_it/region +20 -0
- data/lib/ffaker/data/address_ja/city +0 -23
- data/lib/ffaker/data/address_mx/ags +11 -0
- data/lib/ffaker/data/address_mx/bc +5 -0
- data/lib/ffaker/data/address_mx/bcs +5 -0
- data/lib/ffaker/data/address_mx/camp +11 -0
- data/lib/ffaker/data/address_mx/chih +67 -0
- data/lib/ffaker/data/address_mx/chis +118 -0
- data/lib/ffaker/data/address_mx/coah +38 -0
- data/lib/ffaker/data/address_mx/col +10 -0
- data/lib/ffaker/data/address_mx/df +16 -0
- data/lib/ffaker/data/address_mx/dgo +39 -0
- data/lib/ffaker/data/address_mx/gro +81 -0
- data/lib/ffaker/data/address_mx/gto +46 -0
- data/lib/ffaker/data/address_mx/hgo +84 -0
- data/lib/ffaker/data/address_mx/jal +125 -0
- data/lib/ffaker/data/address_mx/mex +125 -0
- data/lib/ffaker/data/address_mx/mich +113 -0
- data/lib/ffaker/data/address_mx/mor +33 -0
- data/lib/ffaker/data/address_mx/nay +20 -0
- data/lib/ffaker/data/address_mx/nl +51 -0
- data/lib/ffaker/data/address_mx/oax +570 -0
- data/lib/ffaker/data/address_mx/pue +217 -0
- data/lib/ffaker/data/address_mx/qr +10 -0
- data/lib/ffaker/data/address_mx/qro +18 -0
- data/lib/ffaker/data/address_mx/sin +18 -0
- data/lib/ffaker/data/address_mx/slp +58 -0
- data/lib/ffaker/data/address_mx/son +72 -0
- data/lib/ffaker/data/address_mx/state +1 -1
- data/lib/ffaker/data/address_mx/state_abbr +1 -1
- data/lib/ffaker/data/address_mx/tab +17 -0
- data/lib/ffaker/data/address_mx/tamps +43 -0
- data/lib/ffaker/data/address_mx/tlax +60 -0
- data/lib/ffaker/data/address_mx/ver +212 -0
- data/lib/ffaker/data/address_mx/yuc +106 -0
- data/lib/ffaker/data/address_mx/zac +58 -0
- data/lib/ffaker/data/address_ru/city +1 -1
- data/lib/ffaker/data/address_se/city +1 -1
- data/lib/ffaker/data/address_se/countries +1 -1
- data/lib/ffaker/data/address_se/street +1 -1
- data/lib/ffaker/data/address_sn/arrondissements +1 -1
- data/lib/ffaker/data/address_sn/departements +1 -1
- data/lib/ffaker/data/address_sn/regions +1 -1
- data/lib/ffaker/data/address_uk/county +1 -1
- data/lib/ffaker/data/address_us/state +1 -1
- data/lib/ffaker/data/address_us/state_abbr +1 -2
- data/lib/ffaker/data/address_us/state_and_territories_abbr +1 -1
- data/lib/ffaker/data/animal_br/common_names +423 -0
- data/lib/ffaker/data/animal_cn/common_names +141 -0
- data/lib/ffaker/data/animal_es/common_names +135 -0
- data/lib/ffaker/data/animal_pl/common_names +256 -0
- data/lib/ffaker/data/animal_us/common_names +141 -0
- data/lib/ffaker/data/aws/ec2_reserved_instance_tenancy +1 -1
- data/lib/ffaker/data/aws/ec2_reserved_offering_type +1 -1
- data/lib/ffaker/data/aws/ec2_reserved_product_description +1 -1
- data/lib/ffaker/data/bank/card_types +12 -0
- data/lib/ffaker/data/book/nouns +2 -2
- data/lib/ffaker/data/cheesy_lingo/cheesy_phrases +1 -1
- data/lib/ffaker/data/cheesy_lingo/cheesy_words +1 -1
- data/lib/ffaker/data/color/names_list +1 -1
- data/lib/ffaker/data/color_pl/names_list +122 -0
- data/lib/ffaker/data/company/bs_mid +1 -1
- data/lib/ffaker/data/company/bs_pos +1 -1
- data/lib/ffaker/data/company/bs_pre +1 -1
- data/lib/ffaker/data/company/catch_mid +1 -1
- data/lib/ffaker/data/company/catch_pos +1 -1
- data/lib/ffaker/data/company/catch_pre +1 -1
- data/lib/ffaker/data/company/position_areas +1 -1
- data/lib/ffaker/data/conference/conference_list +1 -1
- data/lib/ffaker/data/currency/currency_code +1 -1
- data/lib/ffaker/data/currency/currency_name +1 -1
- data/lib/ffaker/data/currency/currency_symbol +0 -1
- data/lib/ffaker/data/dizzle_ipsum/dizzle_words +1 -1
- data/lib/ffaker/data/education/major_noun +1 -1
- data/lib/ffaker/data/education/school_suffix +1 -1
- data/lib/ffaker/data/education_cn/city +351 -0
- data/lib/ffaker/data/education_cn/major +506 -0
- data/lib/ffaker/data/education_cn/province +31 -0
- data/lib/ffaker/data/education_cn/school_type +27 -0
- data/lib/ffaker/data/filesystem/extension +31 -31
- data/lib/ffaker/data/food/fruit +1 -1
- data/lib/ffaker/data/food/herb_spice +1 -1
- data/lib/ffaker/data/food/meat +1 -1
- data/lib/ffaker/data/food/vegetable +1 -1
- data/lib/ffaker/data/food_pl/diary +14 -0
- data/lib/ffaker/data/food_pl/fermented +13 -0
- data/lib/ffaker/data/food_pl/fruits +34 -0
- data/lib/ffaker/data/food_pl/herbs +20 -0
- data/lib/ffaker/data/food_pl/meats +9 -0
- data/lib/ffaker/data/food_pl/preserves +10 -0
- data/lib/ffaker/data/food_pl/spices +26 -0
- data/lib/ffaker/data/food_pl/vegetables +45 -0
- data/lib/ffaker/data/freedom_ipsum/freedom_words +161 -0
- data/lib/ffaker/data/game/adj_and_adv +18 -0
- data/lib/ffaker/data/game/category +84 -0
- data/lib/ffaker/data/game/mechanic +182 -0
- data/lib/ffaker/data/game/nouns +37 -0
- data/lib/ffaker/data/game/prefixes +17 -0
- data/lib/ffaker/data/healthcare_ru/doctor_specialization +127 -0
- data/lib/ffaker/data/hipster_ipsum/hipster_words +1 -1
- data/lib/ffaker/data/identification_mx/estados_curp +1 -1
- data/lib/ffaker/data/jo_jo/first_names +356 -0
- data/lib/ffaker/data/jo_jo/full_names +225 -0
- data/lib/ffaker/data/jo_jo/last_names +153 -0
- data/lib/ffaker/data/jo_jo/stands +149 -0
- data/lib/ffaker/data/job/job_adj +1 -1
- data/lib/ffaker/data/job/job_noun +1 -1
- data/lib/ffaker/data/job/job_prefix +1 -1
- data/lib/ffaker/data/job_fr/job_prefixes +1 -1
- data/lib/ffaker/data/job_it/job_adj +37 -0
- data/lib/ffaker/data/job_it/job_noun +25 -0
- data/lib/ffaker/data/job_it/job_prefix +22 -0
- data/lib/ffaker/data/locale/language +1 -1
- data/lib/ffaker/data/locale/language_code +1 -1
- data/lib/ffaker/data/lorem/characters +1 -1
- data/lib/ffaker/data/lorem/words +1 -68
- data/lib/ffaker/data/lorem_ar/words +1 -1
- data/lib/ffaker/data/lorem_br/characters +36 -0
- data/lib/ffaker/data/lorem_br/words +183 -0
- data/lib/ffaker/data/lorem_cn/words +1 -1
- data/lib/ffaker/data/lorem_fr/words +1 -1
- data/lib/ffaker/data/lorem_it/words +321 -0
- data/lib/ffaker/data/movie/adj_and_adv +1 -1
- data/lib/ffaker/data/movie/nouns +3 -3
- data/lib/ffaker/data/movie/prefixes +1 -1
- data/lib/ffaker/data/name/first_names_female +0 -230
- data/lib/ffaker/data/name/first_names_male +0 -37
- data/lib/ffaker/data/name/last_names +1 -2
- data/lib/ffaker/data/name/pronouns +6 -0
- data/lib/ffaker/data/name_ar/first_names_female +1 -1
- data/lib/ffaker/data/name_ar/first_names_male +1 -1
- data/lib/ffaker/data/name_ar/last_names +1 -1
- data/lib/ffaker/data/name_cn/first_names +1 -1
- data/lib/ffaker/data/name_cn/last_names +1 -1
- data/lib/ffaker/data/name_cs/female_first_names +40 -0
- data/lib/ffaker/data/name_cs/female_last_names +50 -0
- data/lib/ffaker/data/name_cs/male_first_names +88 -0
- data/lib/ffaker/data/name_cs/male_last_names +49 -0
- data/lib/ffaker/data/name_cs/prefixes +4 -4
- data/lib/ffaker/data/name_de/first_names +1 -1
- data/lib/ffaker/data/name_de/last_names +1 -1
- data/lib/ffaker/data/name_fr/first_names +1 -1
- data/lib/ffaker/data/name_fr/last_names +1 -1
- data/lib/ffaker/data/name_ga/first_names_female +1 -1
- data/lib/ffaker/data/name_ga/first_names_male +287 -287
- data/lib/ffaker/data/name_gr/female_first_names +1 -1
- data/lib/ffaker/data/name_gr/female_last_names +1 -1
- data/lib/ffaker/data/name_gr/male_first_names +1 -1
- data/lib/ffaker/data/name_gr/male_last_names +1 -1
- data/lib/ffaker/data/name_in/first_names_female +100 -0
- data/lib/ffaker/data/name_in/first_names_male +100 -0
- data/lib/ffaker/data/name_in/last_names +100 -0
- data/lib/ffaker/data/name_it/first_names +1 -1
- data/lib/ffaker/data/name_it/last_names +1 -1
- data/lib/ffaker/data/name_ja/first_names +1 -1
- data/lib/ffaker/data/name_ja/last_names +1 -1
- data/lib/ffaker/data/name_kh/first_names +1 -1
- data/lib/ffaker/data/name_kh/nick_names +1 -1
- data/lib/ffaker/data/name_kr/first_names +1 -1
- data/lib/ffaker/data/name_kr/last_names +1 -1
- data/lib/ffaker/data/name_mx/female_first_names +1 -1
- data/lib/ffaker/data/name_mx/last_names +1 -1
- data/lib/ffaker/data/name_mx/male_first_names +1 -1
- data/lib/ffaker/data/name_ph/autochthonous_surnames +1 -1
- data/lib/ffaker/data/name_ph/spanish_surnames +1 -1
- data/lib/ffaker/data/name_ru/first_names_female +91 -0
- data/lib/ffaker/data/name_ru/first_names_male +172 -0
- data/lib/ffaker/data/name_ru/last_names_female +100 -0
- data/lib/ffaker/data/name_ru/last_names_male +100 -0
- data/lib/ffaker/data/name_ru/middle_names_female +65 -0
- data/lib/ffaker/data/name_ru/middle_names_male +73 -0
- data/lib/ffaker/data/name_se/first_names_female +1 -1
- data/lib/ffaker/data/name_se/first_names_male +1 -1
- data/lib/ffaker/data/name_se/last_names +1 -1
- data/lib/ffaker/data/name_sn/first_names_female +1 -1
- data/lib/ffaker/data/name_sn/first_names_male +1 -1
- data/lib/ffaker/data/name_sn/last_names +1 -1
- data/lib/ffaker/data/name_th/first_names +1 -1
- data/lib/ffaker/data/name_th/last_names +1 -1
- data/lib/ffaker/data/name_th/nick_names +1 -1
- data/lib/ffaker/data/name_tw/first_names +122 -0
- data/lib/ffaker/data/name_tw/last_names +100 -0
- data/lib/ffaker/data/nato_alphabet/alphabet_codes +26 -0
- data/lib/ffaker/data/nato_alphabet/numeric_codes +10 -0
- data/lib/ffaker/data/phone_number_ja/four_disit_area_codes +41 -0
- data/lib/ffaker/data/phone_number_ja/one_disit_area_codes +3 -0
- data/lib/ffaker/data/phone_number_ja/three_disit_area_codes +296 -0
- data/lib/ffaker/data/phone_number_ja/two_disit_area_codes +48 -0
- data/lib/ffaker/data/phone_number_nl/area_codes +142 -0
- data/lib/ffaker/data/phone_number_ru/home_phone_prefixes +107 -0
- data/lib/ffaker/data/phone_number_ru/mobile_phone_prefixes +61 -0
- data/lib/ffaker/data/phone_number_se/phone_prefix +1 -1
- data/lib/ffaker/data/phone_number_ua/home_phone_prefixes +29 -0
- data/lib/ffaker/data/phone_number_ua/mobile_phone_prefixes +11 -0
- data/lib/ffaker/data/product/adj +1 -1
- data/lib/ffaker/data/product/b1 +1 -1
- data/lib/ffaker/data/product/noun +4 -1
- data/lib/ffaker/data/skill/specialty_end +1 -1
- data/lib/ffaker/data/skill/specialty_start +1 -1
- data/lib/ffaker/data/skill/tech_skills +1 -1
- data/lib/ffaker/data/sport_pl/summer +53 -0
- data/lib/ffaker/data/sport_pl/winter +14 -0
- data/lib/ffaker/data/sport_ru/summer +68 -0
- data/lib/ffaker/data/sport_ru/winter +20 -0
- data/lib/ffaker/data/sport_us/names +67 -0
- data/lib/ffaker/data/vehicle/color_prefixes +25 -0
- data/lib/ffaker/data/vehicle/displacements_list +1 -1
- data/lib/ffaker/data/vehicle/fuel_types_list +1 -1
- data/lib/ffaker/data/vehicle/makes_list +1 -1
- data/lib/ffaker/data/vehicle/transmissions_list +1 -1
- data/lib/ffaker/data/vehicle/upholstery_list +1 -1
- data/lib/ffaker/data/venue/venue_list +1 -1
- data/lib/ffaker/date.rb +40 -0
- data/lib/ffaker/dizzle_ipsum.rb +1 -3
- data/lib/ffaker/education.rb +9 -10
- data/lib/ffaker/education_cn.rb +37 -0
- data/lib/ffaker/filesystem.rb +18 -8
- data/lib/ffaker/food.rb +2 -0
- data/lib/ffaker/food_pl.rb +65 -0
- data/lib/ffaker/freedom_ipsum.rb +20 -0
- data/lib/ffaker/game.rb +33 -0
- data/lib/ffaker/gender.rb +1 -1
- data/lib/ffaker/gender_br.rb +1 -1
- data/lib/ffaker/gender_cn.rb +1 -1
- data/lib/ffaker/gender_id.rb +0 -1
- data/lib/ffaker/gender_it.rb +17 -0
- data/lib/ffaker/gender_ja.rb +18 -0
- data/lib/ffaker/gender_jp.rb +11 -0
- data/lib/ffaker/gender_kr.rb +1 -1
- data/lib/ffaker/gender_pl.rb +19 -0
- data/lib/ffaker/gender_ru.rb +22 -0
- data/lib/ffaker/geolocation.rb +34 -24
- data/lib/ffaker/guid.rb +1 -1
- data/lib/ffaker/healthcare_ipsum.rb +1 -3
- data/lib/ffaker/healthcare_ru.rb +12 -0
- data/lib/ffaker/hipster_ipsum.rb +1 -3
- data/lib/ffaker/html_ipsum.rb +10 -4
- data/lib/ffaker/identification.rb +5 -2
- data/lib/ffaker/identification_br.rb +4 -13
- data/lib/ffaker/identification_ec.rb +39 -0
- data/lib/ffaker/identification_es.rb +1 -1
- data/lib/ffaker/identification_es_cl.rb +7 -6
- data/lib/ffaker/identification_es_co.rb +3 -4
- data/lib/ffaker/identification_in.rb +15 -0
- data/lib/ffaker/identification_it.rb +30 -0
- data/lib/ffaker/identification_kr.rb +13 -6
- data/lib/ffaker/identification_mx.rb +14 -20
- data/lib/ffaker/identification_pl.rb +77 -0
- data/lib/ffaker/identification_tw.rb +24 -0
- data/lib/ffaker/image.rb +37 -14
- data/lib/ffaker/internet.rb +18 -25
- data/lib/ffaker/internet_se.rb +8 -10
- data/lib/ffaker/jo_jo.rb +24 -0
- data/lib/ffaker/job.rb +1 -1
- data/lib/ffaker/job_br.rb +1 -1
- data/lib/ffaker/job_cn.rb +1 -1
- data/lib/ffaker/job_fr.rb +1 -1
- data/lib/ffaker/job_it.rb +12 -0
- data/lib/ffaker/job_ja.rb +0 -1
- data/lib/ffaker/job_kr.rb +1 -1
- data/lib/ffaker/job_vn.rb +0 -1
- data/lib/ffaker/locale.rb +8 -12
- data/lib/ffaker/lorem.rb +6 -7
- data/lib/ffaker/lorem_ar.rb +1 -1
- data/lib/ffaker/lorem_br.rb +45 -0
- data/lib/ffaker/lorem_cn.rb +1 -2
- data/lib/ffaker/lorem_fr.rb +1 -1
- data/lib/ffaker/lorem_ie.rb +0 -1
- data/lib/ffaker/lorem_it.rb +39 -0
- data/lib/ffaker/lorem_ja.rb +2 -2
- data/lib/ffaker/lorem_kr.rb +1 -1
- data/lib/ffaker/lorem_pl.rb +0 -2
- data/lib/ffaker/lorem_ru.rb +1 -2
- data/lib/ffaker/lorem_ua.rb +3 -5
- data/lib/ffaker/movie.rb +8 -5
- data/lib/ffaker/music.rb +1 -1
- data/lib/ffaker/name.rb +5 -1
- data/lib/ffaker/name_ar.rb +0 -1
- data/lib/ffaker/name_br.rb +1 -1
- data/lib/ffaker/name_cn.rb +1 -1
- data/lib/ffaker/name_cs.rb +7 -9
- data/lib/ffaker/name_da.rb +2 -4
- data/lib/ffaker/name_de.rb +1 -3
- data/lib/ffaker/name_es.rb +0 -2
- data/lib/ffaker/name_fr.rb +5 -5
- data/lib/ffaker/name_ga.rb +1 -1
- data/lib/ffaker/name_gr.rb +2 -3
- data/lib/ffaker/name_id.rb +0 -1
- data/lib/ffaker/name_in.rb +39 -0
- data/lib/ffaker/name_it.rb +2 -3
- data/lib/ffaker/name_ja.rb +1 -1
- data/lib/ffaker/name_kh.rb +2 -0
- data/lib/ffaker/name_kr.rb +1 -1
- data/lib/ffaker/name_mx.rb +4 -6
- data/lib/ffaker/name_nb.rb +1 -3
- data/lib/ffaker/name_nl.rb +1 -3
- data/lib/ffaker/name_ph.rb +1 -3
- data/lib/ffaker/name_pl.rb +2 -3
- data/lib/ffaker/name_ru.rb +32 -71
- data/lib/ffaker/name_se.rb +1 -3
- data/lib/ffaker/name_sn.rb +3 -6
- data/lib/ffaker/name_th.rb +1 -1
- data/lib/ffaker/name_th_en.rb +2 -2
- data/lib/ffaker/name_tw.rb +20 -0
- data/lib/ffaker/name_ua.rb +1 -3
- data/lib/ffaker/name_vn.rb +1 -1
- data/lib/ffaker/nato_alphabet.rb +2 -4
- data/lib/ffaker/number.rb +30 -0
- data/lib/ffaker/phone_number.rb +1 -1
- data/lib/ffaker/phone_number_au.rb +11 -12
- data/lib/ffaker/phone_number_br.rb +16 -14
- data/lib/ffaker/phone_number_ch.rb +1 -1
- data/lib/ffaker/phone_number_cu.rb +18 -27
- data/lib/ffaker/phone_number_da.rb +1 -3
- data/lib/ffaker/phone_number_de.rb +4 -5
- data/lib/ffaker/phone_number_fr.rb +3 -12
- data/lib/ffaker/phone_number_id.rb +2 -6
- data/lib/ffaker/phone_number_it.rb +9 -7
- data/lib/ffaker/phone_number_ja.rb +88 -0
- data/lib/ffaker/phone_number_kr.rb +1 -1
- data/lib/ffaker/phone_number_mx.rb +1 -2
- data/lib/ffaker/phone_number_nl.rb +9 -12
- data/lib/ffaker/phone_number_pl.rb +68 -0
- data/lib/ffaker/phone_number_ru.rb +120 -0
- data/lib/ffaker/phone_number_se.rb +1 -1
- data/lib/ffaker/phone_number_sg.rb +1 -1
- data/lib/ffaker/phone_number_sn.rb +12 -19
- data/lib/ffaker/phone_number_tw.rb +49 -0
- data/lib/ffaker/phone_number_ua.rb +42 -0
- data/lib/ffaker/product.rb +10 -12
- data/lib/ffaker/sem_ver.rb +19 -0
- data/lib/ffaker/skill.rb +2 -2
- data/lib/ffaker/sport.rb +4 -0
- data/lib/ffaker/sport_pl.rb +25 -0
- data/lib/ffaker/sport_ru.rb +25 -0
- data/lib/ffaker/sport_us.rb +12 -0
- data/lib/ffaker/ssn.rb +5 -5
- data/lib/ffaker/ssn_mx.rb +1 -2
- data/lib/ffaker/ssn_se.rb +16 -44
- data/lib/ffaker/string.rb +18 -17
- data/lib/ffaker/time.rb +12 -11
- data/lib/ffaker/tweet.rb +4 -4
- data/lib/ffaker/unit.rb +10 -11
- data/lib/ffaker/unit_english.rb +19 -22
- data/lib/ffaker/unit_metric.rb +16 -19
- data/lib/ffaker/utils/array_utils.rb +8 -5
- data/lib/ffaker/utils/module_utils.rb +27 -6
- data/lib/ffaker/utils/random_utils.rb +4 -0
- data/lib/ffaker/utils/unique_utils.rb +32 -21
- data/lib/ffaker/vehicle.rb +67 -9
- data/lib/ffaker/venue.rb +1 -1
- data/lib/ffaker/version.rb +5 -0
- data/lib/ffaker/youtube.rb +1 -1
- data/lib/ffaker.rb +74 -164
- data/scripts/benchmark.rb +12 -11
- data/scripts/profiling.rb +3 -1
- data/scripts/reference.rb +26 -24
- data/test/helper.rb +41 -6
- data/test/test_address.rb +2 -2
- data/test/test_address_au.rb +7 -8
- data/test/test_address_br.rb +17 -4
- data/test/test_address_ca.rb +2 -2
- data/test/test_address_ch.rb +2 -2
- data/test/test_address_ch_de.rb +2 -2
- data/test/test_address_ch_fr.rb +2 -2
- data/test/test_address_ch_it.rb +2 -2
- data/test/test_address_da.rb +5 -5
- data/test/test_address_de.rb +2 -2
- data/test/test_address_fi.rb +4 -5
- data/test/test_address_fr.rb +3 -4
- data/test/test_address_gr.rb +2 -2
- data/test/test_address_id.rb +2 -3
- data/test/test_address_in.rb +2 -2
- data/test/test_address_it.rb +12 -0
- data/test/test_address_ja.rb +2 -3
- data/test/test_address_kr.rb +1 -2
- data/test/test_address_mx.rb +2 -3
- data/test/test_address_nl.rb +3 -3
- data/test/test_address_pl.rb +1 -2
- data/test/test_address_ru.rb +2 -2
- data/test/test_address_se.rb +4 -4
- data/test/test_address_sn.rb +2 -5
- data/test/test_address_ua.rb +2 -2
- data/test/test_address_uk.rb +2 -2
- data/test/test_address_us.rb +11 -2
- data/test/test_airline.rb +2 -2
- data/test/test_animal.rb +2 -2
- data/test/test_animal_br.rb +17 -0
- data/test/test_animal_cn.rb +17 -0
- data/test/test_animal_es.rb +17 -0
- data/test/test_animal_pl.rb +17 -0
- data/test/test_animal_us.rb +17 -0
- data/test/test_array_utils.rb +3 -3
- data/test/test_avatar.rb +35 -10
- data/test/test_aws.rb +3 -3
- data/test/test_bacon_ipsum.rb +2 -2
- data/test/test_bank.rb +53 -0
- data/test/test_bank_us.rb +35 -0
- data/test/test_book.rb +35 -6
- data/test/test_boolean.rb +3 -3
- data/test/test_cheesy_lingo.rb +4 -2
- data/test/test_code.rb +23 -3
- data/test/test_color.rb +2 -2
- data/test/test_color_pl.rb +13 -0
- data/test/test_color_ua.rb +2 -2
- data/test/test_company.rb +4 -4
- data/test/test_company_cn.rb +2 -2
- data/test/test_company_fr.rb +33 -0
- data/test/test_company_it.rb +2 -2
- data/test/test_company_ja.rb +28 -0
- data/test/test_company_se.rb +2 -2
- data/test/test_conference.rb +2 -2
- data/test/test_course_mathematiques.rb +3 -1
- data/test/test_course_philosophie.rb +3 -1
- data/test/test_crypto.rb +15 -0
- data/test/test_currency.rb +2 -2
- data/test/test_date.rb +47 -0
- data/test/test_dizzle_ipsum.rb +2 -2
- data/test/test_education.rb +2 -2
- data/test/test_education_cn.rb +29 -0
- data/test/{test_faker.rb → test_ffaker.rb} +7 -3
- data/test/test_filesystem.rb +39 -5
- data/test/test_food.rb +3 -3
- data/test/test_food_pl.rb +61 -0
- data/test/test_freedom_ipsum.rb +21 -0
- data/test/test_game.rb +28 -0
- data/test/test_gender.rb +3 -3
- data/test/test_gender_br.rb +2 -2
- data/test/test_gender_cn.rb +2 -2
- data/test/test_gender_id.rb +1 -2
- data/test/test_gender_it.rb +27 -0
- data/test/test_gender_ja.rb +27 -0
- data/test/test_gender_jp.rb +27 -0
- data/test/test_gender_kr.rb +2 -2
- data/test/test_gender_pl.rb +27 -0
- data/test/test_gender_ru.rb +23 -0
- data/test/test_geolocation.rb +4 -4
- data/test/test_guid.rb +2 -2
- data/test/test_healthcare_ipsum.rb +3 -1
- data/test/test_healthcare_ru.rb +19 -0
- data/test/test_hipster_ipsum.rb +2 -2
- data/test/test_html_ipsum.rb +20 -14
- data/test/test_identification.rb +14 -4
- data/test/test_identification_br.rb +2 -2
- data/test/test_identification_co.rb +5 -3
- data/test/test_identification_ec.rb +33 -0
- data/test/test_identification_es.rb +2 -2
- data/test/test_identification_es_cl.rb +3 -3
- data/test/test_identification_es_mx.rb +5 -4
- data/test/test_identification_in.rb +20 -0
- data/test/test_identification_it.rb +45 -0
- data/test/test_identification_kr.rb +5 -5
- data/test/test_identification_pl.rb +28 -0
- data/test/test_identification_tw.rb +17 -0
- data/test/test_image.rb +56 -10
- data/test/test_internet.rb +18 -16
- data/test/test_internet_se.rb +12 -9
- data/test/test_jo_jo.rb +29 -0
- data/test/test_job.rb +2 -2
- data/test/test_job_br.rb +2 -2
- data/test/test_job_cn.rb +3 -3
- data/test/test_job_fr.rb +2 -2
- data/test/test_job_it.rb +17 -0
- data/test/test_job_ja.rb +3 -3
- data/test/test_job_kr.rb +3 -3
- data/test/test_job_vn.rb +2 -3
- data/test/test_locale.rb +2 -2
- data/test/test_lorem.rb +6 -2
- data/test/test_lorem_ar.rb +3 -4
- data/test/test_lorem_br.rb +62 -0
- data/test/test_lorem_cn.rb +11 -11
- data/test/test_lorem_fr.rb +14 -12
- data/test/test_lorem_ie.rb +1 -2
- data/test/test_lorem_it.rb +51 -0
- data/test/test_lorem_ja.rb +5 -5
- data/test/test_lorem_kr.rb +2 -2
- data/test/test_lorem_pl.rb +2 -3
- data/test/test_lorem_ru.rb +3 -4
- data/test/test_lorem_ua.rb +4 -4
- data/test/test_module_utils.rb +35 -2
- data/test/test_movie.rb +2 -2
- data/test/test_music.rb +6 -6
- data/test/test_name.rb +7 -3
- data/test/test_name_ar.rb +1 -2
- data/test/test_name_br.rb +2 -2
- data/test/test_name_cn.rb +2 -2
- data/test/test_name_cs.rb +3 -4
- data/test/test_name_da.rb +5 -5
- data/test/test_name_de.rb +2 -2
- data/test/test_name_es.rb +1 -2
- data/test/test_name_fr.rb +2 -3
- data/test/test_name_ga.rb +2 -2
- data/test/test_name_gr.rb +2 -2
- data/test/test_name_id.rb +1 -2
- data/test/test_name_it.rb +2 -3
- data/test/test_name_ja.rb +2 -2
- data/test/test_name_kh.rb +10 -8
- data/test/test_name_kr.rb +2 -2
- data/test/test_name_mx.rb +2 -3
- data/test/test_name_nb.rb +2 -2
- data/test/test_name_nl.rb +2 -2
- data/test/test_name_ph.rb +2 -2
- data/test/test_name_pl.rb +1 -2
- data/test/test_name_ru.rb +38 -48
- data/test/test_name_se.rb +2 -2
- data/test/test_name_sn.rb +2 -3
- data/test/test_name_th.rb +2 -2
- data/test/test_name_th_en.rb +2 -2
- data/test/test_name_tw.rb +28 -0
- data/test/test_name_ua.rb +3 -3
- data/test/test_name_vn.rb +2 -2
- data/test/test_nato_alphabet.rb +2 -2
- data/test/test_number.rb +57 -0
- data/test/test_phone_number.rb +3 -3
- data/test/test_phone_number_au.rb +5 -6
- data/test/test_phone_number_br.rb +12 -5
- data/test/test_phone_number_cu.rb +5 -12
- data/test/test_phone_number_da.rb +2 -3
- data/test/test_phone_number_de.rb +2 -3
- data/test/test_phone_number_fr.rb +1 -2
- data/test/test_phone_number_id.rb +1 -2
- data/test/test_phone_number_it.rb +12 -0
- data/test/test_phone_number_ja.rb +63 -0
- data/test/test_phone_number_kr.rb +2 -2
- data/test/test_phone_number_mx.rb +2 -3
- data/test/test_phone_number_nl.rb +3 -4
- data/test/test_phone_number_pl.rb +56 -0
- data/test/test_phone_number_ru.rb +76 -0
- data/test/test_phone_number_se.rb +4 -4
- data/test/test_phone_number_sg.rb +10 -10
- data/test/test_phone_number_sn.rb +4 -5
- data/test/test_phone_number_tw.rb +42 -0
- data/test/test_phone_number_ua.rb +38 -0
- data/test/test_products.rb +2 -2
- data/test/test_sem_ver.rb +18 -0
- data/test/test_skill.rb +2 -2
- data/test/test_sport_pl.rb +30 -0
- data/test/test_sport_ru.rb +30 -0
- data/test/test_sport_us.rb +17 -0
- data/test/test_sports.rb +2 -2
- data/test/test_ssn.rb +2 -2
- data/test/test_ssn_mx.rb +2 -3
- data/test/test_ssn_se.rb +10 -12
- data/test/test_string.rb +8 -8
- data/test/test_time.rb +14 -8
- data/test/test_tweet.rb +11 -11
- data/test/test_unique_utils.rb +31 -7
- data/test/test_units.rb +9 -9
- data/test/test_units_english.rb +17 -18
- data/test/test_units_metric.rb +17 -18
- data/test/test_vehicle.rb +32 -5
- data/test/test_venue.rb +2 -2
- data/test/test_youtube.rb +2 -2
- metadata +211 -198
- data/lib/ffaker/data/address_jp/city +0 -127
- data/lib/ffaker/data/address_jp/designated_city +0 -20
- data/lib/ffaker/data/address_jp/street +0 -37
- data/lib/ffaker/data/address_jp/tokyo_ward +0 -23
- data/lib/ffaker/data/address_jp/village +0 -183
- data/lib/ffaker/data/address_jp/ward +0 -188
data/lib/ffaker.rb
CHANGED
@@ -1,193 +1,105 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'ffaker/version'
|
4
|
+
require 'pathname'
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
module FFaker
|
7
|
+
require_relative 'ffaker/utils/array_utils'
|
8
|
+
require_relative 'ffaker/utils/module_utils'
|
6
9
|
|
7
10
|
extend ModuleUtils
|
8
11
|
|
9
|
-
BASE_LIB_PATH = File.expand_path(
|
12
|
+
BASE_LIB_PATH = File.expand_path(__dir__)
|
10
13
|
|
11
|
-
LETTERS =
|
14
|
+
LETTERS = Array('a'..'z').freeze
|
12
15
|
|
13
16
|
HEX = %w[0 1 2 3 4 5 6 7 8 9 A B C D E F].freeze
|
14
17
|
|
15
18
|
def self.hexify(*masks)
|
16
|
-
fetch_sample(masks.flatten).gsub(
|
19
|
+
fetch_sample(masks.flatten).gsub('#') { fetch_sample(HEX) }
|
17
20
|
end
|
18
21
|
|
19
22
|
def self.numerify(*masks)
|
20
|
-
fetch_sample(masks.flatten).gsub(
|
23
|
+
fetch_sample(masks.flatten).gsub('#') { rand(0..9).to_s }
|
21
24
|
end
|
22
25
|
|
23
26
|
def self.letterify(*masks)
|
24
|
-
fetch_sample(masks.flatten).gsub(
|
27
|
+
fetch_sample(masks.flatten).gsub('?') { fetch_sample(LETTERS) }
|
25
28
|
end
|
26
29
|
|
27
30
|
def self.bothify(masks)
|
28
31
|
letterify(numerify(masks))
|
29
32
|
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
autoload :HTMLIpsum, 'ffaker/html_ipsum'
|
89
|
-
autoload :Identification, 'ffaker/identification'
|
90
|
-
autoload :IdentificationBR, 'ffaker/identification_br'
|
91
|
-
autoload :IdentificationES, 'ffaker/identification_es'
|
92
|
-
autoload :IdentificationESCL, 'ffaker/identification_es_cl'
|
93
|
-
autoload :IdentificationESCO, 'ffaker/identification_es_co'
|
94
|
-
autoload :IdentificationKr, 'ffaker/identification_kr'
|
95
|
-
autoload :IdentificationMX, 'ffaker/identification_mx'
|
96
|
-
autoload :Image, 'ffaker/image'
|
97
|
-
autoload :Internet, 'ffaker/internet'
|
98
|
-
autoload :InternetSE, 'ffaker/internet_se'
|
99
|
-
autoload :Job, 'ffaker/job'
|
100
|
-
autoload :JobBR, 'ffaker/job_br'
|
101
|
-
autoload :JobCN, 'ffaker/job_cn'
|
102
|
-
autoload :JobFR, 'ffaker/job_fr'
|
103
|
-
autoload :JobJA, 'ffaker/job_ja'
|
104
|
-
autoload :JobKR, 'ffaker/job_kr'
|
105
|
-
autoload :JobVN, 'ffaker/job_vn'
|
106
|
-
autoload :Locale, 'ffaker/locale'
|
107
|
-
autoload :Lorem, 'ffaker/lorem'
|
108
|
-
autoload :LoremAR, 'ffaker/lorem_ar'
|
109
|
-
autoload :LoremCN, 'ffaker/lorem_cn'
|
110
|
-
autoload :LoremFR, 'ffaker/lorem_fr'
|
111
|
-
autoload :LoremIE, 'ffaker/lorem_ie'
|
112
|
-
autoload :LoremJA, 'ffaker/lorem_ja'
|
113
|
-
autoload :LoremKR, 'ffaker/lorem_kr'
|
114
|
-
autoload :LoremPL, 'ffaker/lorem_pl'
|
115
|
-
autoload :LoremRU, 'ffaker/lorem_ru'
|
116
|
-
autoload :LoremUA, 'ffaker/lorem_ua'
|
117
|
-
autoload :Movie, 'ffaker/movie'
|
118
|
-
autoload :Music, 'ffaker/music'
|
119
|
-
autoload :Name, 'ffaker/name'
|
120
|
-
autoload :NameAR, 'ffaker/name_ar'
|
121
|
-
autoload :NameBR, 'ffaker/name_br'
|
122
|
-
autoload :NameCN, 'ffaker/name_cn'
|
123
|
-
autoload :NameCS, 'ffaker/name_cs'
|
124
|
-
autoload :NameDA, 'ffaker/name_da'
|
125
|
-
autoload :NameDE, 'ffaker/name_de'
|
126
|
-
autoload :NameES, 'ffaker/name_es'
|
127
|
-
autoload :NameFR, 'ffaker/name_fr'
|
128
|
-
autoload :NameGA, 'ffaker/name_ga'
|
129
|
-
autoload :NameGR, 'ffaker/name_gr'
|
130
|
-
autoload :NameID, 'ffaker/name_id'
|
131
|
-
autoload :NameIT, 'ffaker/name_it'
|
132
|
-
autoload :NameJA, 'ffaker/name_ja'
|
133
|
-
autoload :NameKH, 'ffaker/name_kh'
|
134
|
-
autoload :NameKR, 'ffaker/name_kr'
|
135
|
-
autoload :NameMX, 'ffaker/name_mx'
|
136
|
-
autoload :NameNB, 'ffaker/name_nb'
|
137
|
-
autoload :NameNL, 'ffaker/name_nl'
|
138
|
-
autoload :NamePH, 'ffaker/name_ph'
|
139
|
-
autoload :NamePL, 'ffaker/name_pl'
|
140
|
-
autoload :NameRU, 'ffaker/name_ru'
|
141
|
-
autoload :NameSE, 'ffaker/name_se'
|
142
|
-
autoload :NameSN, 'ffaker/name_sn'
|
143
|
-
autoload :NameTH, 'ffaker/name_th'
|
144
|
-
autoload :NameTHEN, 'ffaker/name_th_en'
|
145
|
-
autoload :NameUA, 'ffaker/name_ua'
|
146
|
-
autoload :NameVN, 'ffaker/name_vn'
|
147
|
-
autoload :NatoAlphabet, 'ffaker/nato_alphabet'
|
148
|
-
autoload :PhoneNumber, 'ffaker/phone_number'
|
149
|
-
autoload :PhoneNumberAU, 'ffaker/phone_number_au'
|
150
|
-
autoload :PhoneNumberBR, 'ffaker/phone_number_br'
|
151
|
-
autoload :PhoneNumberCH, 'ffaker/phone_number_ch'
|
152
|
-
autoload :PhoneNumberCU, 'ffaker/phone_number_cu'
|
153
|
-
autoload :PhoneNumberDA, 'ffaker/phone_number_da'
|
154
|
-
autoload :PhoneNumberDE, 'ffaker/phone_number_de'
|
155
|
-
autoload :PhoneNumberFR, 'ffaker/phone_number_fr'
|
156
|
-
autoload :PhoneNumberID, 'ffaker/phone_number_id'
|
157
|
-
autoload :PhoneNumberIT, 'ffaker/phone_number_it'
|
158
|
-
autoload :PhoneNumberKR, 'ffaker/phone_number_kr'
|
159
|
-
autoload :PhoneNumberMX, 'ffaker/phone_number_mx'
|
160
|
-
autoload :PhoneNumberNL, 'ffaker/phone_number_nl'
|
161
|
-
autoload :PhoneNumberSE, 'ffaker/phone_number_se'
|
162
|
-
autoload :PhoneNumberSG, 'ffaker/phone_number_sg'
|
163
|
-
autoload :PhoneNumberSN, 'ffaker/phone_number_sn'
|
164
|
-
autoload :Product, 'ffaker/product'
|
165
|
-
autoload :Skill, 'ffaker/skill'
|
166
|
-
autoload :Sport, 'ffaker/sport'
|
167
|
-
autoload :SSN, 'ffaker/ssn'
|
168
|
-
autoload :SSNMX, 'ffaker/ssn_mx'
|
169
|
-
autoload :SSNSE, 'ffaker/ssn_se'
|
170
|
-
autoload :String, 'ffaker/string'
|
171
|
-
autoload :Time, 'ffaker/time'
|
172
|
-
autoload :Tweet, 'ffaker/tweet'
|
173
|
-
autoload :Unit, 'ffaker/unit'
|
174
|
-
autoload :UnitEnglish, 'ffaker/unit_english'
|
175
|
-
autoload :UnitMetric, 'ffaker/unit_metric'
|
176
|
-
autoload :Vehicle, 'ffaker/vehicle'
|
177
|
-
autoload :Venue, 'ffaker/venue'
|
178
|
-
autoload :Youtube, 'ffaker/youtube'
|
34
|
+
autoload_acronyms = {
|
35
|
+
'ar' => 'AR',
|
36
|
+
'au' => 'AU',
|
37
|
+
'aws' => 'AWS',
|
38
|
+
'br' => 'BR',
|
39
|
+
'ca' => 'CA',
|
40
|
+
'ch' => 'CH',
|
41
|
+
'cl' => 'CL',
|
42
|
+
'cn' => 'CN',
|
43
|
+
'co' => 'CO',
|
44
|
+
'cs' => 'CS',
|
45
|
+
'cu' => 'CU',
|
46
|
+
'da' => 'DA',
|
47
|
+
'de' => 'DE',
|
48
|
+
'ec' => 'EC',
|
49
|
+
'en' => 'EN',
|
50
|
+
'es' => 'ES',
|
51
|
+
'fi' => 'FI',
|
52
|
+
'fr' => 'FR',
|
53
|
+
'ga' => 'GA',
|
54
|
+
'gr' => 'GR',
|
55
|
+
'html' => 'HTML',
|
56
|
+
'id' => 'ID',
|
57
|
+
'ie' => 'IE',
|
58
|
+
'in' => 'IN',
|
59
|
+
'it' => 'IT',
|
60
|
+
'ja' => 'JA',
|
61
|
+
'jp' => 'JP',
|
62
|
+
'kh' => 'KH',
|
63
|
+
'kr' => 'KR',
|
64
|
+
'mx' => 'MX',
|
65
|
+
'nb' => 'NB',
|
66
|
+
'nl' => 'NL',
|
67
|
+
'ph' => 'PH',
|
68
|
+
'pl' => 'PL',
|
69
|
+
'ru' => 'RU',
|
70
|
+
'se' => 'SE',
|
71
|
+
'sg' => 'SG',
|
72
|
+
'sn' => 'SN',
|
73
|
+
'ssn' => 'SSN',
|
74
|
+
'th' => 'TH',
|
75
|
+
'tw' => 'TW',
|
76
|
+
'ua' => 'UA',
|
77
|
+
'uk' => 'UK',
|
78
|
+
'us' => 'US',
|
79
|
+
'vn' => 'VN'
|
80
|
+
}
|
81
|
+
|
82
|
+
directory = "#{__dir__}/ffaker"
|
83
|
+
Dir["#{directory}/*.rb"].each do |file_name|
|
84
|
+
relative_file_path = Pathname.new(file_name).relative_path_from(directory).to_s.chomp('.rb')
|
85
|
+
## Don't consider files in sub-directories
|
86
|
+
constant_name = relative_file_path.split('_').map do |part|
|
87
|
+
autoload_acronyms.fetch(part) { part.capitalize }
|
88
|
+
end.join
|
89
|
+
autoload constant_name, file_name
|
90
|
+
end
|
179
91
|
|
180
92
|
# Random Number Generator (RNG) used with ModuleUtils#fetch, #shuffle, #rand
|
181
93
|
# in order to provide deterministic repeatability.
|
182
94
|
module Random
|
183
95
|
# Returns the current RNG seed.
|
184
96
|
def self.seed
|
185
|
-
@
|
97
|
+
@seed ||= ::Random.new_seed
|
186
98
|
end
|
187
99
|
|
188
100
|
# Sets the RNG seed and creates a new internal RNG.
|
189
101
|
def self.seed=(new_seed)
|
190
|
-
@
|
102
|
+
@seed = new_seed
|
191
103
|
reset!
|
192
104
|
new_seed
|
193
105
|
end
|
@@ -199,11 +111,9 @@ module FFaker
|
|
199
111
|
|
200
112
|
# Returns a random number using an RNG with a known seed.
|
201
113
|
def self.rand(max = nil)
|
202
|
-
if max
|
203
|
-
|
204
|
-
|
205
|
-
rng.rand
|
206
|
-
end
|
114
|
+
return rng.rand(max) if max
|
115
|
+
|
116
|
+
rng.rand
|
207
117
|
end
|
208
118
|
|
209
119
|
# Returns the current Random object.
|
data/scripts/benchmark.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'benchmark'
|
3
4
|
|
4
|
-
|
5
|
+
NAMES_COUNT = 10_000
|
5
6
|
|
6
7
|
def run(name)
|
7
|
-
require name
|
8
8
|
Benchmark.bm do |rep|
|
9
|
-
rep.report("generating #{
|
10
|
-
|
11
|
-
|
12
|
-
end
|
9
|
+
rep.report("generating #{NAMES_COUNT} names (#{name})") do
|
10
|
+
mod = name == 'ffaker' ? FFaker : Faker
|
11
|
+
NAMES_COUNT.times { mod::Name.name }
|
13
12
|
end
|
14
13
|
end
|
15
|
-
$stdout.flush
|
16
|
-
exit(0)
|
17
14
|
end
|
18
15
|
|
19
|
-
|
20
|
-
|
16
|
+
%w[faker ffaker].each do |gem_name|
|
17
|
+
require gem_name
|
18
|
+
|
19
|
+
fork { run(gem_name) }
|
20
|
+
Process.wait
|
21
|
+
end
|
data/scripts/profiling.rb
CHANGED
data/scripts/reference.rb
CHANGED
@@ -1,28 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../lib/ffaker'
|
4
|
+
require 'set'
|
5
|
+
|
6
|
+
# always use the same seed for consistency
|
7
|
+
FFaker::Random.seed = 1337
|
3
8
|
|
4
9
|
ICONS = {
|
5
10
|
error: '‼️',
|
6
11
|
warning: '❗'
|
7
12
|
}.freeze
|
8
13
|
|
14
|
+
UTILS_MODULES = %i[ArrayUtils ModuleUtils RandomUtils Random Version].freeze
|
15
|
+
UTILS_METHODS = %i[k underscore fetch_sample rand shuffle unique luhn_check].freeze
|
16
|
+
|
9
17
|
# Get a list of sections
|
10
18
|
def faker_modules
|
11
|
-
FFaker
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
next if mod == FFaker::Random
|
18
|
-
mod
|
19
|
-
end.compact
|
19
|
+
FFaker
|
20
|
+
.constants
|
21
|
+
.reject { |const| UTILS_MODULES.include?(const) }
|
22
|
+
.select { |const| FFaker.const_get(const).instance_of?(Module) }
|
23
|
+
.sort
|
24
|
+
.map { |const| FFaker.const_get(const) }
|
20
25
|
end
|
21
26
|
|
22
27
|
# Returns faker methods for a given module
|
23
28
|
def faker_methods(mod)
|
24
|
-
methods = mod.methods - Module.methods -
|
25
|
-
%i[k underscore fetch_sample rand shuffle unique]
|
29
|
+
methods = mod.methods - Module.methods - UTILS_METHODS
|
26
30
|
|
27
31
|
# For Company.name (et al), don't discard :name if it was reimplemented
|
28
32
|
methods << :name if mod.send(:name) != mod.to_s
|
@@ -32,12 +36,14 @@ end
|
|
32
36
|
# Catch deprecation warnings.
|
33
37
|
# This `#warn` overrides Kernel#warn
|
34
38
|
def warn(msg)
|
35
|
-
|
39
|
+
return unless Kernel.instance_variable_get(:@ffaker_warnings)
|
40
|
+
|
41
|
+
Kernel.instance_variable_set(:@ffaker_warnings, Kernel.instance_variable_get(:@ffaker_warnings) << msg)
|
36
42
|
end
|
37
43
|
|
38
44
|
def catch_warnings
|
39
|
-
|
40
|
-
[yield,
|
45
|
+
Kernel.instance_variable_set(:@ffaker_warnings, [])
|
46
|
+
[yield, Kernel.instance_variable_get(:@ffaker_warnings)]
|
41
47
|
end
|
42
48
|
|
43
49
|
def escape(str)
|
@@ -59,19 +65,15 @@ sections = faker_modules.map do |mod|
|
|
59
65
|
left = "`#{meth}`"
|
60
66
|
right = ''
|
61
67
|
|
62
|
-
if arity
|
68
|
+
if arity.positive?
|
63
69
|
left = "`#{meth}`(#{Array.new(arity) { '...' }.join(', ')})"
|
64
70
|
else
|
65
71
|
begin
|
66
72
|
examples, warnings = catch_warnings do
|
67
|
-
Array.new(3) { mod.send meth }
|
73
|
+
Array.new(3) { mod.unique.send meth }
|
68
74
|
end
|
69
|
-
right =
|
70
|
-
|
71
|
-
else
|
72
|
-
(escape examples.join(', ')).to_s
|
73
|
-
end
|
74
|
-
rescue => e
|
75
|
+
right = warnings.any? ? "#{ICONS[:warning]} *#{warnings.first}*" : (escape examples.join(', ')).to_s
|
76
|
+
rescue StandardError => e
|
75
77
|
right = "#{ICONS[:error]} #{e.class}: #{e.message}"
|
76
78
|
end
|
77
79
|
end
|
data/test/helper.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'test/unit'
|
2
|
-
|
4
|
+
require_relative '../lib/ffaker'
|
3
5
|
|
4
6
|
# Helpers for checking if a method is deterministic -- e.g., that the Random
|
5
7
|
# results are repeatable given the same random seed.
|
@@ -11,21 +13,54 @@ module DeterministicHelper
|
|
11
13
|
# Accepts a block. Executes the block multiple times after resetting
|
12
14
|
# the internal Random Number Generator state and compared the results of
|
13
15
|
# each execution to make sure they are the same.
|
14
|
-
def assert_deterministic(options = {})
|
15
|
-
raise ArgumentError, 'Must pass a block' unless
|
16
|
+
def assert_deterministic(options = {}, &block)
|
17
|
+
raise ArgumentError, 'Must pass a block' unless block
|
16
18
|
|
17
19
|
options = { message: 'Results are not repeatable' }.merge(options)
|
18
20
|
|
19
21
|
returns = Array.new(2) do
|
20
22
|
FFaker::Random.reset!
|
21
|
-
Array.new(5)
|
22
|
-
yield
|
23
|
-
end
|
23
|
+
Array.new(5, &block)
|
24
24
|
end
|
25
25
|
|
26
26
|
assert(returns.uniq.length == 1, options[:message])
|
27
27
|
end
|
28
28
|
|
29
|
+
%w[< > <= >=].each do |operator|
|
30
|
+
operator_name =
|
31
|
+
case operator[0]
|
32
|
+
when '<' then 'less_than'
|
33
|
+
when '>' then 'greater_than'
|
34
|
+
else raise 'Unexpected operator'
|
35
|
+
end
|
36
|
+
operator_name += '_or_equal_to' if operator[1] == '='
|
37
|
+
|
38
|
+
define_method "assert_#{operator_name}" do |got, expected|
|
39
|
+
assert(
|
40
|
+
got.public_send(operator, expected),
|
41
|
+
"Expected #{operator} \"#{expected}\", but got #{got}"
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def assert_between(got, range)
|
47
|
+
assert_greater_than_or_equal_to got, range.begin
|
48
|
+
public_send "assert_less_than#{'_or_equal_to' unless range.exclude_end?}", got, range.end
|
49
|
+
end
|
50
|
+
|
51
|
+
def assert_random(original_block, *args)
|
52
|
+
100.times do
|
53
|
+
yield(*args)
|
54
|
+
assert_deterministic(&original_block)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
%w[less_than_or_equal_to between].each do |method_name|
|
59
|
+
define_method "assert_random_#{method_name}" do |*args, &block|
|
60
|
+
assert_random(block) { send "assert_#{method_name}", block.call, *args }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
29
64
|
# Methods to be called outside of individual examples.
|
30
65
|
module ClassMethods
|
31
66
|
# Shorthand method to quickly test the determinability of multiple methods.
|
data/test/test_address.rb
CHANGED
data/test/test_address_au.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
|
-
# Author: wiseleyb<wiseleyb@gmail.com>
|
6
5
|
class TestAddressAU < Test::Unit::TestCase
|
7
6
|
include DeterministicHelper
|
8
7
|
|
@@ -12,9 +11,9 @@ class TestAddressAU < Test::Unit::TestCase
|
|
12
11
|
)
|
13
12
|
|
14
13
|
def test_au_state_abbr_insertion
|
15
|
-
|
16
|
-
assert
|
17
|
-
assert
|
14
|
+
FFaker::AddressAU::STATE_ABBR.sort
|
15
|
+
assert FFaker::AddressAU::SUBURB.keys.sort
|
16
|
+
assert FFaker::AddressAU::POSTCODE.keys.sort
|
18
17
|
end
|
19
18
|
|
20
19
|
def test_au_state
|
@@ -34,7 +33,7 @@ class TestAddressAU < Test::Unit::TestCase
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def test_full_address
|
37
|
-
assert_match(/[
|
36
|
+
assert_match(/[, a-z]/, FFaker::AddressAU.full_address)
|
38
37
|
end
|
39
38
|
|
40
39
|
def test_au_suburb_with_states
|
@@ -61,7 +60,7 @@ class TestAddressAU < Test::Unit::TestCase
|
|
61
60
|
|
62
61
|
def test_full_address_with_states
|
63
62
|
FFaker::AddressAU::STATE_ABBR.each do |st_abbr|
|
64
|
-
assert_match(/[
|
63
|
+
assert_match(/[, a-z]/, FFaker::AddressAU.full_address(st_abbr))
|
65
64
|
assert_deterministic { FFaker::AddressAU.full_address(st_abbr) }
|
66
65
|
end
|
67
66
|
end
|
data/test/test_address_br.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestAddressBR < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
7
7
|
|
8
8
|
assert_methods_are_deterministic(
|
9
9
|
FFaker::AddressBR,
|
10
|
-
:zip_code, :state, :state_abbr, :city, :street_prefix, :street, :full_address
|
10
|
+
:zip_code, :state, :state_abbr, :city, :street_prefix, :street, :complement, :neighborhood, :full_address
|
11
11
|
)
|
12
12
|
|
13
13
|
def test_zip_code
|
@@ -32,6 +32,19 @@ class TestAddressBR < Test::Unit::TestCase
|
|
32
32
|
|
33
33
|
def test_street
|
34
34
|
prefixes = FFaker::AddressBR::STREET_PREFIX
|
35
|
-
assert_match(
|
35
|
+
assert_match(/\A(#{prefixes.join('|')})(?: [\p{Alpha}-]+)+\z/, FFaker::AddressBR.street)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_complement
|
39
|
+
assert_match(/\A(?:Apartamento \d{3}|Casa Térrea|Fundos)\z/, FFaker::AddressBR.complement)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_neighborhood
|
43
|
+
neighborhood_prefix = FFaker::AddressBR.neighborhood.split(' ').first
|
44
|
+
assert FFaker::AddressBR::NEIGHBORHOOD_PREFIXES.include?(neighborhood_prefix)
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_full_address
|
48
|
+
assert_match(/\A[\p{Alpha}\d, -]+\z/, FFaker::AddressBR.full_address)
|
36
49
|
end
|
37
50
|
end
|
data/test/test_address_ca.rb
CHANGED
data/test/test_address_ch.rb
CHANGED
data/test/test_address_ch_de.rb
CHANGED
data/test/test_address_ch_fr.rb
CHANGED
data/test/test_address_ch_it.rb
CHANGED
data/test/test_address_da.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'helper'
|
4
4
|
|
5
5
|
class TestAddressDA < Test::Unit::TestCase
|
6
6
|
include DeterministicHelper
|
@@ -20,11 +20,11 @@ class TestAddressDA < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_state
|
23
|
-
assert_match(/\A[-ÆØÅæøåa-z
|
23
|
+
assert_match(/\A[-ÆØÅæøåa-z]+\z/i, FFaker::AddressDA.state)
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_kommune
|
27
|
-
assert_match(/\A[-ÆØÅæøåa-z
|
27
|
+
assert_match(/\A[-ÆØÅæøåa-z]+\z/i, FFaker::AddressDA.kommune)
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_region
|
@@ -32,7 +32,7 @@ class TestAddressDA < Test::Unit::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_city
|
35
|
-
assert_match(/\A[- ÆØÅæøåla-z
|
35
|
+
assert_match(/\A[- ÆØÅæøåla-z]+\z/i, FFaker::AddressDA.city)
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_street_name
|
data/test/test_address_de.rb
CHANGED