br-utilities 0.0.0 → 1.0.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 +4 -4
- data/CHANGELOG.md +17 -0
- data/LICENSE +9 -0
- data/README.md +1303 -0
- data/README.pt.md +1296 -0
- data/src/br-utilities/br_utils.rb +268 -0
- data/src/br-utilities/cnpj_fmt.rb +18 -0
- data/src/br-utilities/cnpj_gen.rb +18 -0
- data/src/br-utilities/cnpj_utils.rb +8 -0
- data/src/br-utilities/cnpj_val.rb +18 -0
- data/src/br-utilities/cpf_fmt.rb +18 -0
- data/src/br-utilities/cpf_gen.rb +18 -0
- data/src/br-utilities/cpf_utils.rb +8 -0
- data/src/br-utilities/cpf_val.rb +14 -0
- data/src/br-utilities/errors.rb +23 -0
- data/src/br-utilities/version.rb +7 -1
- data/src/br-utilities.rb +34 -6
- metadata +36 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6eabcc64660fc18f823df61333a18864ae3f294964d6bf6bcf753927ac0bae6b
|
|
4
|
+
data.tar.gz: dfaf98ce0f68fa7205dace677dc3becc65d47217d515d7beaa19f614d6ae7996
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 574a3473fc92f9a0634305bfb5468ef57547f97960658c126dd1cccc65414b71645f31e943ef542c90314484d267209ded42c1d4a7e063682f6cd26b995cc48b
|
|
7
|
+
data.tar.gz: 70d8079a8896c861538f611a82fb8d7a5a7dfc60dd89a4d0668a89abc4a42b8dc4283b0a9eb3e80a855959785d8492aa0bbfd8a2fe45fbc225a60e7f0cb213b7
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# br-utilities
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### 🚀 Stable Version Released!
|
|
6
|
+
|
|
7
|
+
Unified toolkit to deal with Brazilian documents (CPF and CNPJ): validation, formatting, and generation of valid IDs. Main features:
|
|
8
|
+
|
|
9
|
+
- **Unified façade**: `BrUtils` aggregates configurable `CpfUtils` and `CnpjUtils` behind `#cpf` / `#cnpj` accessors (with setters; `nil` resets to defaults).
|
|
10
|
+
- **Constructor flexibility**: accept a settings `Hash` or keyword args (`cpf:` / `cnpj:` nested mappings, or flat `cpf_formatter:` / `cnpj_validator:`-style kwargs; nested wins when both present).
|
|
11
|
+
- **Quick helpers**: `BrUtils.cpf` / `.cnpj` delegate to `BrUtils::DEFAULT.cpf` / `.cnpj` (process-wide; prefer `BrUtils.new` under concurrency).
|
|
12
|
+
- **Two-tier re-exports**: main classes at the façade root (`BrUtils::CpfFormatter`, `BrUtils::CnpjValidator`, …); full sibling surface under `BrUtils::CpfFmt` / `CpfUtils` / `CnpjFmt` / ….
|
|
13
|
+
- **One install**: depends on `cpf-utilities` and `cnpj-utilities` so both domains ship without requiring each gem separately.
|
|
14
|
+
- **Alphanumeric CNPJ**: CNPJ path supports 14-character alphanumeric IDs via `cnpj-utilities` (numeric CPF via `cpf-utilities`).
|
|
15
|
+
- **Structured errors**: `BrUtils::TypeMismatchError` / `InvalidArgumentCombinationError` (+ `BrUtils::Error` marker) for façade misuse; README documents every propagated `CpfFmt` / `CpfGen` / `CpfVal` / `CnpjFmt` / `CnpjGen` / `CnpjVal` leaf (including `on_fail` `InvalidLengthError`).
|
|
16
|
+
|
|
17
|
+
For detailed usage and API reference, see the [README](./README.md).
|
data/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Julio L. Muller
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|