predicate-rb 1.2.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 +7 -0
- data/CHANGELOG.md +64 -0
- data/EXAMPLES.md +4183 -0
- data/LICENSE.txt +21 -0
- data/README.md +764 -0
- data/lib/predicate/combinators.rb +322 -0
- data/lib/predicate/core.rb +403 -0
- data/lib/predicate/dsl.rb +355 -0
- data/lib/predicate/model_integration.rb +410 -0
- data/lib/predicate/railtie.rb +19 -0
- data/lib/predicate/util.rb +36 -0
- data/lib/predicate/validation.rb +244 -0
- data/lib/predicate/version.rb +5 -0
- data/lib/predicate-rb.rb +6 -0
- data/lib/predicate.rb +279 -0
- metadata +85 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 241ded1a9fae50e90744cd41b6372d3509221ca23fe1e475fe9451b2f5ecd7a6
|
|
4
|
+
data.tar.gz: 97e6115a084326f87aa990d645f37df3cd61db373354e6193f2d1776c5f6cefc
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 64db44a9ac0cbfb8660a5caff8ee66d5e6a7fc91638007fdc6cf966d4e85bcb6b390ff34bd4d44ef246e106340192852caaa1afbd2d574071cfdf10ae651d7af
|
|
7
|
+
data.tar.gz: e620b8d3b168d2694317c855d12ce843c39aef68d2dbf6d095c1c36068cf6946f797c3886a47fc99183f531ca14e5cfaa71f1bb7872db3de73dc251a0a2503f2
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. The release
|
|
4
|
+
workflow refuses to publish a version with no entry — see RELEASING.md.
|
|
5
|
+
|
|
6
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
7
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
|
+
|
|
9
|
+
## [1.2.0] - 2026-02-24
|
|
10
|
+
|
|
11
|
+
First public release on RubyGems, as `predicate-rb` (the name `predicate`
|
|
12
|
+
belongs to an unrelated gem). `require "predicate"` and the `Predicate`
|
|
13
|
+
constant are unchanged; `lib/predicate-rb.rb` only requires `predicate`, so
|
|
14
|
+
`Bundler.require` works with `gem "predicate-rb"`.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- **Breaking:** the validation helpers `present?(value)` and `blank?(value)` are
|
|
18
|
+
renamed `is_present?(value)` and `is_blank?(value)`. Under Rails, Active
|
|
19
|
+
Support defines zero-argument `Object#present?`/`#blank?`, which Ruby found
|
|
20
|
+
before `method_missing`; the call raised `ArgumentError` and the predicate
|
|
21
|
+
silently returned `false`.
|
|
22
|
+
- Including `Predicate::ModelIntegration` loads the model's predicate file by
|
|
23
|
+
naming convention; models no longer call `load_predicates!` explicitly.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- `method_missing` lazy-loads definitions, so a predicate called before its file
|
|
27
|
+
was loaded no longer reports as undefined.
|
|
28
|
+
|
|
29
|
+
## [1.1.0] - 2026-02-09
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
- Rails: predicate definition files are ignored by Zeitwerk instead of being
|
|
33
|
+
added to `autoload_paths`, so they register without having to define a
|
|
34
|
+
constant matching their filename.
|
|
35
|
+
|
|
36
|
+
## [1.0.0] - 2026-01-28
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- Initial release as standalone gem
|
|
40
|
+
- Pure boolean predicate DSL with method_missing syntax
|
|
41
|
+
- Automatic memoization with SHA256-based cache keys
|
|
42
|
+
- TTL (time-to-live) cache expiration support
|
|
43
|
+
- Thread-safe operations via optional Mutex
|
|
44
|
+
- LRU cache eviction (1000 entry limit)
|
|
45
|
+
- Logical combinators: `all_of`, `any_of`, `none_of`, `not_predicate`
|
|
46
|
+
- Conditional combinators: `when_present`, `when_blank`
|
|
47
|
+
- Section-based predicate grouping
|
|
48
|
+
- Rails model integration via `Predicate::ModelIntegration`
|
|
49
|
+
- Railtie for automatic Rails integration
|
|
50
|
+
- Performance monitoring and statistics
|
|
51
|
+
- 27 English-like validation helpers
|
|
52
|
+
- Rails validation pattern generators
|
|
53
|
+
- Predicate file generator for models
|
|
54
|
+
- Comprehensive test suite (183 runs, 508 assertions)
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- Extracted from StockLive codebase into standalone gem
|
|
58
|
+
- Fixed Zeitwerk compatibility (proper gem directory structure)
|
|
59
|
+
- Removed Rails-specific Rubocop directives for broader compatibility
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
- Cache collision issues with SHA256-based keys
|
|
63
|
+
- Section predicate caching consistency
|
|
64
|
+
- Thread-safety for concurrent environments
|