zengin_lite 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1bd1615a98a69ef75d84bee347add6a97ec7c6b8379a3ec6f819562438c0a8dc
4
+ data.tar.gz: a08142fef0806359cde5aa72c86f8a753b67636f47d8d3308e3b3c921d4983d8
5
+ SHA512:
6
+ metadata.gz: 5badad29ff71bba1bfcac693c85c5ff9f353a5fa9c32fd754014dfd8eae2d4e50d3e6ba082fe10e69116832d636039e15c94155e9f5b39773f9cf6379fdcd8e2
7
+ data.tar.gz: e080aee4d196a4644fcfc7100ff298f01a059143ebe8c1e1a3da0d4670bc0ec75ef33fa4d08e6e6ea9048d57d291b7cf5dfb02baa7b810d4781a96fb5e13197e
data/.yardoc/checksums ADDED
@@ -0,0 +1,5 @@
1
+ lib/zengin_lite.rb d518a122e134675475192bccdac2427659c196e3
2
+ lib/zengin_lite/bank.rb 99e97a39dd8bae1e33df304fcc0bba2781a96ad1
3
+ lib/zengin_lite/branch.rb 7fb6032820dd54ce8f63a2da59270724d5a69b4e
4
+ lib/zengin_lite/version.rb 0e597aca7d715adc1e9682612636f2a5dac0140b
5
+ lib/zengin_lite/database.rb 1a3028a4c49d16ab410852421ea8157e0587be36
data/.yardoc/complete ADDED
File without changes
Binary file
Binary file
Binary file
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --markup markdown
2
+ --readme README.md
3
+ lib
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 YOUR_NAME
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # ZenginLite
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/zengin_lite.svg)](https://badge.fury.io/rb/zengin_lite)
4
+ [![update](https://github.com/kromiii/zengin-lite/actions/workflows/update.yml/badge.svg)](https://github.com/kromiii/zengin-lite/actions/workflows/update.yml)
5
+
6
+ A lightweight implementation of [zengin-code/zengin-rb](https://github.com/zengin-code/zengin-rb).
7
+
8
+ The name "zengin-lite" comes from the fact that it uses SQLite to store and query bank and branch data.
9
+
10
+ Rebuilt from scratch with focus on:
11
+ - ⚡️ Fast startup time (5-10ms)
12
+ - 💾 Low memory footprint (1MB)
13
+ - 🔍 Flexible query capabilities
14
+
15
+ ## Performance & Trade-offs
16
+
17
+ This gem (`zengin-lite`) is designed as a lightweight alternative to `zengin-rb`.
18
+
19
+ ### When to use `zengin-lite`
20
+ - **Web Applications / API Servers**: When you need to validate bank codes or look up branch names occasionally in user requests.
21
+ - **Memory Constrained Environments**: Running on FaaS (AWS Lambda, etc.) or small containers where memory usage matters. `zengin-lite` keeps memory usage very low (~1MB) by querying SQLite on demand.
22
+
23
+ ### When to use `zengin-rb`
24
+ - **Batch Processing / Heavy Loops**: If you need to iterate over thousands of banks/branches or perform bulk data processing.
25
+ - **Maximum Performance**: `zengin-rb` loads all data into memory (Hash), offering microsecond-level access speed at the cost of higher memory usage (20MB+).
26
+
27
+ ## Installation
28
+
29
+ Add this line to your application's Gemfile:
30
+
31
+ ```ruby
32
+ gem 'zengin_lite'
33
+ ```
34
+
35
+ Or install it yourself as:
36
+
37
+ ```bash
38
+ $ gem install zengin_lite
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```ruby
44
+ require 'zengin_lite'
45
+
46
+ # Find bank and branch
47
+ bank = ZenginLite.bank("0001") # => #<ZenginLite::Bank code="0001" name="みずほ銀行" ...>
48
+ branch = bank.branch("001") # => #<ZenginLite::Branch code="001" name="東京営業部" ...>
49
+
50
+ # Search banks
51
+ banks = ZenginLite.search_banks(name: "三井")
52
+
53
+ # Check existence (returns nil if not found)
54
+ ZenginLite.bank("9999") # => nil
55
+ ```
56
+
57
+ For more detailed API documentation, please refer to the [YARD documentation](https://rubydoc.info/gems/zengin_lite).
58
+
59
+ ## Data Source
60
+
61
+ This gem uses data from [zengin-code/source-data](https://github.com/zengin-code/source-data), which is automatically updated daily.
62
+
63
+ ## Development
64
+
65
+ ```bash
66
+ # Clone with submodule
67
+ $ git clone --recursive https://github.com/kromiii/zengin-lite.git
68
+ $ cd zengin-lite
69
+ $ bundle install
70
+
71
+ # Update source data and build database
72
+ $ git submodule update --remote
73
+ $ bundle exec rake db:build
74
+
75
+ # Run tests
76
+ $ bundle exec rake test
77
+
78
+ # Verify database integrity
79
+ $ bundle exec rake db:verify
80
+
81
+ # Build and install locally (database will be built automatically)
82
+ $ bundle exec rake install
83
+
84
+ # Generate documentation
85
+ $ bundle exec yard doc
86
+ $ open doc/index.html
87
+ ```
88
+
89
+ ## License
90
+
91
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
11
+
12
+ namespace :db do
13
+ desc "Build the database from source data"
14
+ task :build do
15
+ ruby "scripts/build_database.rb"
16
+ end
17
+
18
+ desc "Verify the database integrity"
19
+ task :verify do
20
+ ruby "scripts/verify_database.rb"
21
+ end
22
+ end
23
+
24
+ task :build => 'db:build'
data/data/zengin.db ADDED
Binary file