name_generator 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +9 -0
- data/lib/data/names.json +41 -0
- data/lib/name_generator/version.rb +3 -0
- data/lib/name_generator.rb +37 -0
- metadata +50 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bfca00c5ca9d4824befc3b65cd9fedef4071ff099d68c5f72e0be56c5ba28bc1
|
4
|
+
data.tar.gz: 84a1699d857ecb61d6127d5f8e238d22c9b3afec190ca03a001db2815e9a86f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6683c73d30d97413207ec1a0335b7687a706ac21802368ca350e78bfc5929ef36f6bb910563fbf4200730ec4b3fc62b3c50c9e68b73ac4ea0550a84e6d821a62
|
7
|
+
data.tar.gz: 75ef2a4e4268353f66134b0423fc82d5aff82bc6fea3b2d72fa897601edcc09055e6c6b980b25fac87c3138735e42d975a3dbe58eff5dbb5ea48e969ae3e45cf
|
data/README.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Name-Generator
|
2
|
+
|
3
|
+
NameGenerator is a Ruby library for generating random names and surnames. It supports multiple countries and genders, making it a versatile tool for generating realistic names for testing, simulation, or other purposes.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
To use the module, simply require it and call the modules and functions.
|
8
|
+
You can find examples in example.rb
|
9
|
+
If you want, you can add more names in data/names.json
|
data/lib/data/names.json
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"BR_MALE_FIRST_NAMES": [
|
3
|
+
"Carlos", "Eduardo", "Felipe", "Gustavo", "Henrique", "Igor", "João", "Lucas",
|
4
|
+
"Mateus", "Paulo", "Ricardo", "Tiago", "Victor", "William", "Bruno", "Daniel"
|
5
|
+
],
|
6
|
+
|
7
|
+
"BR_FEMALE_FIRST_NAMES": [
|
8
|
+
"Ana", "Beatriz", "Carla", "Diana", "Fernanda", "Gabriela", "Helena", "Isabela",
|
9
|
+
"Juliana", "Larissa", "Mariana", "Natália", "Paula", "Rafaela", "Sara", "Vanessa"
|
10
|
+
],
|
11
|
+
|
12
|
+
"BR_LAST_NAMES": [
|
13
|
+
"Almeida", "Barbosa", "Cardoso", "Dias", "Fernandes", "Gomes", "Henrique",
|
14
|
+
"Lima", "Martins", "Neves", "Oliveira", "Pereira", "Queiroz", "Ribeiro",
|
15
|
+
"Silva", "Teixeira", "Vieira", "Xavier"
|
16
|
+
],
|
17
|
+
|
18
|
+
"RU_MALE_FIRST_NAMES": [
|
19
|
+
"Александр", "Алексей", "Андрей", "Антон", "Артём", "Борис", "Вадим", "Валентин", "Валерий", "Василий",
|
20
|
+
"Виктор", "Виталий", "Владимир", "Владислав", "Вячеслав", "Геннадий", "Георгий", "Григорий", "Даниил", "Денис",
|
21
|
+
"Дмитрий", "Евгений", "Иван", "Игорь", "Илья", "Кирилл", "Константин", "Лев", "Леонид", "Максим",
|
22
|
+
"Марк", "Матвей", "Михаил", "Никита", "Николай", "Олег", "Павел", "Пётр", "Родион", "Роман",
|
23
|
+
"Савва", "Семён", "Сергей", "Станислав", "Степан", "Тарас", "Тимофей", "Фёдор", "Филипп", "Ярослав"
|
24
|
+
],
|
25
|
+
|
26
|
+
"RU_FEMALE_FIRST_NAMES": [
|
27
|
+
"Александра", "Алина", "Алиса", "Алла", "Анастасия", "Ангелина", "Анжелика", "Анна", "Валентина", "Валерия",
|
28
|
+
"Варвара", "Василиса", "Вера", "Вероника", "Виктория", "Галина", "Дарья", "Евгения", "Екатерина", "Елена",
|
29
|
+
"Елизавета", "Жанна", "Зинаида", "Зоя", "Инна", "Ирина", "Карина", "Кира", "Ксения", "Лариса",
|
30
|
+
"Лидия", "Лилия", "Любовь", "Людмила", "Маргарита", "Марина", "Мария", "Надежда", "Наталья", "Нина",
|
31
|
+
"Оксана", "Ольга", "Полина", "Раиса", "Светлана", "София", "Тамара", "Татьяна", "Юлия", "Яна"
|
32
|
+
],
|
33
|
+
|
34
|
+
"RU_LAST_NAMES": [
|
35
|
+
"Алексеев", "Андреев", "Артемьев", "Баранов", "Белов", "Богданов", "Борисов", "Васильев", "Волков", "Воробьев",
|
36
|
+
"Герасимов", "Гончаров", "Денисов", "Егоров", "Жуков", "Захаров", "Зайцев", "Игнатьев", "Иванов", "Кириллов",
|
37
|
+
"Климов", "Козлов", "Кузнецов", "Макаров", "Матвеев", "Медведев", "Михайлов", "Назаров", "Никитин", "Николаев",
|
38
|
+
"Носов", "Новиков", "Орлов", "Павлов", "Петров", "Романов", "Семенов", "Сидоров", "Смирнов", "Соколов",
|
39
|
+
"Соловьёв", "Степанов", "Титов", "Тихонов", "Уваров", "Ульянов", "Федоров", "Федотов", "Харитонов", "Юдин"
|
40
|
+
]
|
41
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module NameGenerator
|
4
|
+
@data_cache = {}
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def load_data()
|
8
|
+
data_file = File.expand_path("data/names.json", __dir__)
|
9
|
+
@data_cache = JSON.parse(File.read(data_file))
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_first_name(gender = :male, country = 'BR')
|
13
|
+
data = load_data()
|
14
|
+
gender_prefix = case gender
|
15
|
+
when :male then 'MALE'
|
16
|
+
when :female then 'FEMALE'
|
17
|
+
else raise ArgumentError, "Gender must be :male or :female"
|
18
|
+
end
|
19
|
+
key = "#{country.upcase}_#{gender_prefix}_FIRST_NAMES"
|
20
|
+
names_array = data[key]
|
21
|
+
names_array.sample
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_last_name(country = 'BR')
|
25
|
+
data = load_data()
|
26
|
+
key = "#{country.upcase}_LAST_NAMES"
|
27
|
+
last_names_array = data[key]
|
28
|
+
last_names_array.sample
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_full_name(gender = :male, country = 'BR')
|
32
|
+
first_name = generate_first_name(gender, country)
|
33
|
+
last_name = generate_last_name(country)
|
34
|
+
"#{first_name} #{last_name}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: name_generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Victor Oliveira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This gem generates random names.
|
14
|
+
email:
|
15
|
+
- victorhugodias2001@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- README.md
|
21
|
+
- lib/data/names.json
|
22
|
+
- lib/name_generator.rb
|
23
|
+
- lib/name_generator/version.rb
|
24
|
+
homepage: https://github.com/VictorHugoDiasOliveira/Name-Generator
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata:
|
28
|
+
homepage_uri: https://github.com/VictorHugoDiasOliveira/Name-Generator
|
29
|
+
source_code_uri: https://github.com/VictorHugoDiasOliveira/Name-Generator
|
30
|
+
changelog_uri: https://github.com/VictorHugoDiasOliveira/Name-Generator/CHANGELOG.md
|
31
|
+
post_install_message: Thank you for installing Name-Generator!
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubygems_version: 3.5.17
|
47
|
+
signing_key:
|
48
|
+
specification_version: 4
|
49
|
+
summary: A simple library for generating names for testing purposes.
|
50
|
+
test_files: []
|