name_bank 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +20 -0
- data/lib/name_bank/repository.rb +13 -10
- data/lib/name_bank/version.rb +1 -1
- data/lib/name_bank.rb +7 -4
- metadata +2 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe2659cbdd15df894e97db3be809f9040aa3d58f4c1a3df0353e977053e59dca
|
|
4
|
+
data.tar.gz: 9172dafa9ee2f5fab0d51eb0a0eb7c7c127241631c06a9306d5899349ccab83b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fcbc5f7075593a3da579e91cfaadd1503b976f6457d680b55169d66422826e08e1c6ddc1b37b873444e616a94cf393e4e72524f3f93316dc470c858f0654edbc
|
|
7
|
+
data.tar.gz: 28de093ee1e8e751d6288d659480e240d40755c63a08fa0e59fe4afd23d1ec8e06198634b94bd3f94e9532c086321da90ef9dee10ea2a02a9ba109f2b67b2405
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,26 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.1.6] - 2026-07-24
|
|
8
|
+
|
|
9
|
+
Tooling and internals only — no API, data or behaviour change.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- RuboCop (with rubocop-rspec, rubocop-rake, rubocop-performance) and
|
|
13
|
+
bundler-audit as development dependencies. The default Rake task now runs
|
|
14
|
+
`spec`, `rubocop` and `bundle:audit:check`.
|
|
15
|
+
- `rake release_check`: the same checks, but refreshing the advisory database
|
|
16
|
+
first. Run before releasing.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Development dependencies moved from the gemspec to the `:development` group
|
|
20
|
+
in the Gemfile; the gemspec no longer declares any.
|
|
21
|
+
- Internals split for readability: `Repository#names_for_script` extracted from
|
|
22
|
+
`#pool`, and `SplitScripts.split_country` split into `pools`,
|
|
23
|
+
`add_native_pools`, `split_file` and `latin_only`.
|
|
24
|
+
- Specs reorganised — class specs under `spec/name_bank/`, one assertion per
|
|
25
|
+
example.
|
|
26
|
+
|
|
7
27
|
## [0.1.5] - 2026-07-24
|
|
8
28
|
|
|
9
29
|
Metadata and documentation only — no API, data or behaviour change.
|
data/lib/name_bank/repository.rb
CHANGED
|
@@ -35,20 +35,23 @@ module NameBank
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
37
|
def pool(data, key, script, country)
|
|
38
|
-
names =
|
|
39
|
-
case script
|
|
40
|
-
when :latin then data.fetch(key)
|
|
41
|
-
when :native
|
|
42
|
-
native = data[PoolSchema.native_key(key)]
|
|
43
|
-
native && !native.empty? ? native : data.fetch(key)
|
|
44
|
-
else
|
|
45
|
-
raise ArgumentError, "script must be :latin or :native, got #{script.inspect}"
|
|
46
|
-
end
|
|
38
|
+
names = names_for_script(data, key, script)
|
|
47
39
|
raise UnknownScript, "#{country}/#{script}" if names.nil? || names.empty?
|
|
48
40
|
|
|
49
41
|
names
|
|
50
42
|
end
|
|
51
43
|
|
|
44
|
+
def names_for_script(data, key, script)
|
|
45
|
+
case script
|
|
46
|
+
when :latin then data.fetch(key)
|
|
47
|
+
when :native
|
|
48
|
+
native = data[PoolSchema.native_key(key)]
|
|
49
|
+
native && !native.empty? ? native : data.fetch(key)
|
|
50
|
+
else
|
|
51
|
+
raise ArgumentError, "script must be :latin or :native, got #{script.inspect}"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
52
55
|
def load(country, variant)
|
|
53
56
|
variant ? load_variant(country, variant) : load_country(country)
|
|
54
57
|
end
|
|
@@ -75,7 +78,7 @@ module NameBank
|
|
|
75
78
|
return [] unless Dir.exist?(dir)
|
|
76
79
|
|
|
77
80
|
Dir.children(dir).select { |f| f.end_with?(".yml") }
|
|
78
|
-
|
|
81
|
+
.map { |f| File.basename(f, ".yml") }.sort
|
|
79
82
|
end
|
|
80
83
|
end
|
|
81
84
|
end
|
data/lib/name_bank/version.rb
CHANGED
data/lib/name_bank.rb
CHANGED
|
@@ -4,11 +4,14 @@ require_relative "name_bank/version"
|
|
|
4
4
|
require_relative "name_bank/pool_schema"
|
|
5
5
|
require_relative "name_bank/repository"
|
|
6
6
|
|
|
7
|
+
# Authentic, gender-matched given names and surnames for 106 countries,
|
|
8
|
+
# addressed by ISO alpha-2 country code. Sampling is uniform and deterministic
|
|
9
|
+
# from a caller-supplied RNG — no global locale or random state.
|
|
7
10
|
module NameBank
|
|
8
|
-
Error
|
|
9
|
-
UnknownCountry
|
|
10
|
-
UnknownVariant
|
|
11
|
-
UnknownScript
|
|
11
|
+
class Error < StandardError; end
|
|
12
|
+
class UnknownCountry < Error; end
|
|
13
|
+
class UnknownVariant < Error; end
|
|
14
|
+
class UnknownScript < Error; end
|
|
12
15
|
|
|
13
16
|
DATA_DIR = File.expand_path("../data", __dir__)
|
|
14
17
|
|
metadata
CHANGED
|
@@ -1,42 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: name_bank
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Patrick Bartels
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: rspec
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - "~>"
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '3.13'
|
|
19
|
-
type: :development
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - "~>"
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '3.13'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: rake
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - "~>"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '13.0'
|
|
33
|
-
type: :development
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '13.0'
|
|
11
|
+
dependencies: []
|
|
40
12
|
description: 'NameBank generates authentic, gender-matched given names and surnames
|
|
41
13
|
for 106 countries, addressed by ISO alpha-2 country code, including native-script
|
|
42
14
|
pools (Cyrillic, Arabic, Han, Hangul, Kana, Greek, Hebrew and more) for 35 of them.
|