Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kovacs

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kovacs

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Kovacs

Build Status

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.

Installation

Add this line to your application's Gemfile:

gem 'kovacs'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kovacs

Usage

1. Simpliest

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"} 

2. Generate just one of the attributes

p Kovacs.forename(['Jancsi', 'Julcsi'])
# => "Jancsi" 

3. Generate via config

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"> 

4. Acceptable arguments

  1. None: will be generated based on the nationalities, sex and list of names placed in resources.
Kovacs.forename
  1. Simple String: the value will be the string argument itself.
Kovacs.forename('Jancsi')
  1. Symbol: symbol represents the nationality. Value will be generated based on the specified nationality, and sex which is randomly generated.
Kovacs.forename(:hungarian)
  1. Nationality and sex: Value will be generated based on the spedified nationality and the specified sex.
Kovacs.forename(:hungarian, :male)
  1. Array of Strings: One of them will be taken randomly.
Kovacs.forename(['Jancsi', 'Julcsi'])
  1. Array of Symbols: One of them will be taken randomly, name is taken randomly based on that nationality.
Kovacs.forename([:hungarian, :slovak])
  1. Array of Symbols and sex: Nationality will be taken randomly, name is taken randomly based on that nationality and specified sex.
Kovacs.forename([:hungarian, :slovak], :female)

Development

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.

Plugin for names

  1. Create a folder inside the resources folder. (from this time, this is considered as nationality, whichever name you would pick for it)
  2. Place the following files in the newly created folder:
    • male_forename.txt
    • female_forename.txt
    • surname.txt
  3. Content of these files is considered as forenames and surnames grouped as female and male names.
  4. You can refere to this nationality by using symbols.

Contributing

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.

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.

FAQs

Package last updated on 04 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc