Class: GenFormData
- Inherits:
-
Object
- Object
- GenFormData
- Defined in:
- lib/SykGenData/generators/gen_form_data.rb
Instance Method Summary collapse
- #get_about_me ⇒ Object
- #get_country ⇒ Object
- #get_dob(min_years_old, max_years_old) ⇒ Object
- #get_email ⇒ Object
- #get_fake_location ⇒ Object
- #get_first_name ⇒ Object
- #get_hobby ⇒ Object
- #get_last_name ⇒ Object
- #get_long_password ⇒ Object
-
#get_long_username ⇒ Object
Concatenates usernames from get_username until it has a string 64 characters long.
- #get_long_username_recursion(username) ⇒ Object
- #get_marital_status ⇒ Object
- #get_numeric_string ⇒ Object
- #get_password ⇒ Object
- #get_phone_number ⇒ Object
- #get_username ⇒ Object
Instance Method Details
#get_about_me ⇒ Object
81 82 83 84 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 81 def get_about_me quotes = [Faker::BackToTheFuture.quote, Faker::Friends.quote, Faker::HarryPotter.quote, Faker::GameOfThrones.quote, Faker::Lovecraft.fhtagn(3), Faker::Lovecraft.paragraph, Faker::RickAndMorty.quote, Faker::Seinfeld.quote, Faker::Simpsons.quote, Faker::StarWars.quote, Faker::StarWars.wookiee_sentence, Faker::TheFreshPrinceOfBelAir.quote, Faker::HitchhikersGuideToTheGalaxy.marvin_quote] quotes.sample end |
#get_country ⇒ Object
5 6 7 8 9 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 5 def get_country countries = ["Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Antigua and Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo","Costa Rica","Côte d'Ivoire","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","East Timor","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Fiji","Finland","France","Gabon","Gambia","Georgia","Germany","Ghana","Greece","Greenland","Grenada","Guam","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Japan","Jordan","Kazakhstan","Kenya","Kiribati","North Korea","South Korea","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","New Zealand","Nicaragua","Niger","Nigeria","Norway","Northern Mariana Islands","Oman","Pakistan","Palau","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal","Puerto Rico","Qatar","Romania","Russia","Rwanda","Saint Kitts and Nevis","Saint Lucia", "Saint Vincent and the Grenadines","Samoa","San Marino", "Sao Tome and Principe","Saudi Arabia","Senegal","Serbia and Montenegro","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","Spain","Sri Lanka","Sudan","Sudan, South","Suriname","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States","Uruguay","Uzbekistan","Vanuatu","Vatican City","Venezuela","Vietnam","Virgin Islands, British","Virgin Islands, U.S.","Yemen","Zambia","Zimbabwe"] countries.sample end |
#get_dob(min_years_old, max_years_old) ⇒ Object
25 26 27 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 25 def get_dob min_years_old, max_years_old Faker::Date.birthday(min_years_old, max_years_old).to_s.split('-').map {|x| x.to_i} end |
#get_email ⇒ Object
103 104 105 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 103 def get_email Faker::Internet.free_email end |
#get_fake_location ⇒ Object
11 12 13 14 15 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 11 def get_fake_location location = [Faker::RickAndMorty.location, Faker::Simpsons.location, Faker::StarTrek.location, Faker::StarWars.planet, Faker::Zelda.location, Faker::Witcher.location, Faker::Lovecraft.location, Faker::HarryPotter.location, Faker::HitchhikersGuideToTheGalaxy.location, Faker::HitchhikersGuideToTheGalaxy.planet, Faker::HitchhikersGuideToTheGalaxy.starship] location.sample end |
#get_first_name ⇒ Object
17 18 19 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 17 def get_first_name Faker::Name.first_name end |
#get_hobby ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 40 def get_hobby case Random.new.rand(0..2) when 0 'dance' when 1 'reading' when 2 'cricket' end end |
#get_last_name ⇒ Object
21 22 23 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 21 def get_last_name Faker::Name.last_name end |
#get_long_password ⇒ Object
90 91 92 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 90 def get_long_password Faker::Internet.password(64, 128, true, true) end |
#get_long_username ⇒ Object
Concatenates usernames from get_username until it has a string 64 characters long
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 70 def get_long_username def get_long_username_recursion username if username.length < 64 get_long_username_recursion username += '_' + get_username else username.slice 0...64 end end get_long_username_recursion get_username end |
#get_long_username_recursion(username) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 71 def get_long_username_recursion username if username.length < 64 get_long_username_recursion username += '_' + get_username else username.slice 0...64 end end |
#get_marital_status ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 29 def get_marital_status case Random.new.rand(0..2) when 0 'single' when 1 'married' when 2 'divorced' end end |
#get_numeric_string ⇒ Object
94 95 96 97 98 99 100 101 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 94 def get_numeric_string string = Random.new.rand(0..9).to_s final_length = Random.new.rand(8..16) while string.length < final_length string += Random.new.rand(0..9).to_s end string end |
#get_password ⇒ Object
86 87 88 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 86 def get_password Faker::Internet.password(8, 16, true, true) end |
#get_phone_number ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 51 def get_phone_number phone_number = '07' while phone_number.length<11 phone_number += Random.new.rand(0..9).to_s end phone_number end |
#get_username ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/SykGenData/generators/gen_form_data.rb', line 59 def get_username characters = [Faker::Ancient.god, Faker::Ancient.primordial, Faker::Ancient.titan, Faker::Ancient.hero, Faker::DragonBall.character, Faker::Artist.name, Faker::BackToTheFuture.character, Faker::Book.genre, Faker::DrWho.character, Faker::DrWho.villian, Faker::DrWho.specie, Faker::HarryPotter.character, Faker::LordOfTheRings.character, Faker::Lovecraft.deity, Faker::RickAndMorty.character, Faker::Seinfeld.character, Faker::Simpsons.character, Faker::StarTrek.character, Faker::StarTrek.villain, Faker::StarWars.character, Faker::TheFreshPrinceOfBelAir.character, Faker::Superhero.descriptor] username = characters.sample username += Random.new.rand(0..9).to_s username += Random.new.rand(0..9).to_s username += Random.new.rand(0..9).to_s username.gsub(/\s+/, "") end |