Module: LabClient::Generator::Names
Overview
Name Helper
Instance Method Summary collapse
- #gen_description ⇒ Object
- #gen_groups ⇒ Object
- #gen_people ⇒ Object
- #gen_projects ⇒ Object
-
#generate_names ⇒ Object
rubocop:disable Metrics/AbcSize.
Instance Method Details
#gen_description ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/labclient/generator/names.rb', line 36 def gen_description [ Faker::Hacker.say_something_smart, Faker::Games::LeagueOfLegends.quote, Faker::Company.bs, Faker::Movies::PrincessBride.quote ].sample end |
#gen_groups ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/labclient/generator/names.rb', line 7 def gen_groups [ Faker::Games::LeagueOfLegends.location, Faker::Movies::LordOfTheRings.location, Faker::TvShows::RickAndMorty.location, Faker::TvShows::StarTrek.location, Faker::Games::ElderScrolls.region ].map { |x| x.gsub(/[^0-9A-Za-z]/, '') } end |
#gen_people ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/labclient/generator/names.rb', line 26 def gen_people [ Faker::Movies::LordOfTheRings.character, Faker::Games::WorldOfWarcraft.hero, Faker::TvShows::StarTrek.character, Faker::Games::LeagueOfLegends.champion, Faker::Movies::PrincessBride.character ] end |
#gen_projects ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/labclient/generator/names.rb', line 17 def gen_projects [ Faker::Games::ElderScrolls.creature, Faker::Games::LeagueOfLegends.summoner_spell, Faker::Games::LeagueOfLegends.masteries, Faker::Superhero.power ].map { |x| x.gsub(/[^0-9A-Za-z]/, '') } end |
#generate_names ⇒ Object
rubocop:disable Metrics/AbcSize
46 47 48 49 50 |
# File 'lib/labclient/generator/names.rb', line 46 def generate_names @user_names = Array.new(count[:users]) { gen_people }.flatten.uniq.sample(count[:users]) @group_names = Array.new(count[:groups]) { gen_groups }.flatten.uniq @project_names = Array.new(rand(count[:projects])) { gen_projects.sample }.uniq end |