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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9a25e48d0f047db7cb393aa8545f0857daac15e5febc9f941b48c440f957930
4
- data.tar.gz: 8ad91e35492cf5e6e703246bbffef2804fa2456ce344bd7425532cb3ef145ae0
3
+ metadata.gz: fe2659cbdd15df894e97db3be809f9040aa3d58f4c1a3df0353e977053e59dca
4
+ data.tar.gz: 9172dafa9ee2f5fab0d51eb0a0eb7c7c127241631c06a9306d5899349ccab83b
5
5
  SHA512:
6
- metadata.gz: 3ef330f55cd1fdcb87ca7f1391bc3b1c85af3c033e3bb9a4b349bea43651f8eaa4ea9f3ae9c1bac1db5e758ffb331ee403eb6f4639984dbc6246b95a7d78c5e2
7
- data.tar.gz: df0010e081ef9c6314934dc15c06f98af62b61aac7395c7c66b3f02a0e9540065b192112c58c109cbd3fa64c745c3f4daa3012f71f88b131cc6a6a271943c448
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.
@@ -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
- .map { |f| File.basename(f, ".yml") }.sort
81
+ .map { |f| File.basename(f, ".yml") }.sort
79
82
  end
80
83
  end
81
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NameBank
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
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 = Class.new(StandardError)
9
- UnknownCountry = Class.new(Error)
10
- UnknownVariant = Class.new(Error)
11
- UnknownScript = Class.new(Error)
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.5
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.