Simple fake person generator
Kovacs is one of the most common surnames in Eastern Europe from Slovakia to Hungary to Croatia. (This is the Hungarian form). It means blacksmith in English. With this gem we can smith names based on nationalities.
Kovacs is a simple gem that helps you generate fake data for a person entity based on real life names, nationalities and sex.
Add this line to your application’s Gemfile:
gem 'kovacs'
And then execute:
$ bundle
Or install it yourself as:
$ gem install kovacs
Just simply generate a person. It takes a nationality from the listed nationalities placed inside the resources
folder. (nationality has to be a folder as well.)
Then it generates a sex and based on these two, it generates names.
p Kovacs.generate
# => #<Kovacs::Person:0x0000560e4a3b54f8 @nationality=:slovak, @sex=:male, @forename="Elek", @middle_name="Erno", @surname="Toth">
p Kovacs.generate.to_h
# => {:nationality=>:slovak, :sex=>:male, :forename=>"Miroslav", :middle_name=>"Jan", :surname=>"Cvikota"}
p Kovacs.forename(['Jancsi', 'Julcsi'])
# => "Jancsi"
person = Kovacs.config do |config|
config.surname = :hungarian
config.forename = 'Elek'
config.middle_name = ['Karoly', 'Erno', 'Ervin']
config.sex = :male
config.nationality = [:hungarian, :slovak]
end.generate
p person
# => #<Kovacs::Person:0x0000560e4a3b54f8 @nationality=:slovak, @sex=:male, @forename="Elek", @middle_name="Erno", @surname="Toth">
resources
.Kovacs.forename
Kovacs.forename('Jancsi')
Kovacs.forename(:hungarian)
Kovacs.forename(:hungarian, :male)
Kovacs.forename(['Jancsi', 'Julcsi'])
Kovacs.forename([:hungarian, :slovak])
Kovacs.forename([:hungarian, :slovak], :female)
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
resources
folder. (from this time, this is considered as nationality, whichever name you would pick for it)male_forename.txt
female_forename.txt
surname.txt
Bug reports and pull requests are welcome on GitHub at https://github.com/torokmark/kovacs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
Everyone interacting in the Kovacs project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.