shiny_json_logic 0.1.2 β 0.1.4
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 +15 -0
- data/Gemfile.lock +3 -3
- data/README.md +76 -36
- data/lib/shiny_json_logic/engine.rb +123 -0
- data/lib/shiny_json_logic/operations/coalesce.rb +11 -0
- data/lib/shiny_json_logic/operations/exists.rb +21 -0
- data/lib/shiny_json_logic/operations/val.rb +12 -0
- data/lib/shiny_json_logic/version.rb +1 -1
- data/lib/shiny_json_logic.rb +2 -100
- data/shiny_json_logic.gemspec +23 -5
- metadata +37 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0344634b8f6d210b6968b38d5353c7890df29d927481d23686bc720b8680aab
|
|
4
|
+
data.tar.gz: 8d7e436d54cf970a720415c9bba2af1ab7fe5677718072b42bd756bbba901300
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dcaf78915b3198bdc3da54b9ca0e12e8118105bcea515cd09e1fc83815d3b2d4c63d715c0849e2b7e6348f36754f7a25d2a50221c5e5cb41fc96a26832b085c7
|
|
7
|
+
data.tar.gz: a6e3414cdf9db71cc870e15357fd62e726ac1eba25b134424cc882ea84a33b0af45dc391e16aec6c10ccbfd8ec9b201dc0679d8c5b3f9b8dd03305693cf4d21b
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.4] - 2026-01-25
|
|
6
|
+
### Changed
|
|
7
|
+
- Improve RubyGems metadata and gem description (no runtime changes).
|
|
8
|
+
- Improves README md
|
|
9
|
+
|
|
10
|
+
## [0.1.3]
|
|
11
|
+
### Added
|
|
12
|
+
- Adds Support for `val`, `exists` and `??` operators.
|
|
13
|
+
|
|
14
|
+
## [0.1.0]
|
|
15
|
+
- Initial release with support for legacy JSON Logic operators.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
shiny_json_logic (0.1.
|
|
4
|
+
shiny_json_logic (0.1.4)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -32,10 +32,10 @@ PLATFORMS
|
|
|
32
32
|
ruby
|
|
33
33
|
|
|
34
34
|
DEPENDENCIES
|
|
35
|
-
bundler
|
|
35
|
+
bundler
|
|
36
36
|
byebug
|
|
37
37
|
pry
|
|
38
|
-
rake
|
|
38
|
+
rake
|
|
39
39
|
rspec (~> 3.0)
|
|
40
40
|
shiny_json_logic!
|
|
41
41
|
|
data/README.md
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
# ShinyJsonLogic β¨
|
|
2
2
|
|
|
3
|
-
> Shine bright like a Ruby π
|
|
3
|
+
> Shine bright like a Ruby π
|
|
4
|
+
> **A boring, correct, and production-ready JSON Logic implementation for Ruby.**
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
**ShinyJsonLogic** is a **pure Ruby**, **zero-dependency** implementation of the JSON Logic specification.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
We exist because the original Ruby implementation has been neglected for years.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
This gem focuses on predictable behavior, strict spec alignment, high compatibility and long-term maintainability.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Why ShinyJsonLogic?
|
|
15
|
+
|
|
16
|
+
- β
**Zero runtime dependencies** (stdlib-only). Just plug & play!
|
|
17
|
+
- β
**Ruby 2.7+ compatible, one of the lowest among other Ruby implementations**
|
|
18
|
+
- β
**Actively maintained**
|
|
19
|
+
- β
**High JSON Logic spec coverage**
|
|
20
|
+
- β
**Iterative approach:** Stop worrying about long statements breaking your app.
|
|
21
|
+
- β **Only Ruby implementation supporting the new standard operations up to date.**
|
|
22
|
+
|
|
23
|
+
If you want JSON Logic to *just work* in Ruby, this is the safe default.
|
|
10
24
|
|
|
11
25
|
---
|
|
12
26
|
|
|
@@ -23,17 +37,26 @@ Then run:
|
|
|
23
37
|
```bash
|
|
24
38
|
bundle install
|
|
25
39
|
```
|
|
26
|
-
|
|
40
|
+
|
|
41
|
+
Or install it directly:
|
|
27
42
|
|
|
28
43
|
```bash
|
|
29
44
|
gem install shiny_json_logic
|
|
30
45
|
```
|
|
31
46
|
|
|
47
|
+
and require it in your project:
|
|
48
|
+
|
|
49
|
+
```rubyruby
|
|
50
|
+
require "shiny_json_logic"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
32
55
|
## Usage
|
|
33
56
|
|
|
34
57
|
Basic usage is intentionally simple:
|
|
35
58
|
|
|
36
|
-
```
|
|
59
|
+
```ruby
|
|
37
60
|
require "shiny_json_logic"
|
|
38
61
|
|
|
39
62
|
rule = {
|
|
@@ -49,10 +72,11 @@ ShinyJsonLogic.apply(rule, data)
|
|
|
49
72
|
# => true
|
|
50
73
|
```
|
|
51
74
|
|
|
52
|
-
### Nested
|
|
53
|
-
|
|
75
|
+
### Nested logic
|
|
76
|
+
|
|
77
|
+
Rules can be nested arbitrarily:
|
|
54
78
|
|
|
55
|
-
```
|
|
79
|
+
```ruby
|
|
56
80
|
rule = {
|
|
57
81
|
"if" => [
|
|
58
82
|
{ "var" => "financing" },
|
|
@@ -65,76 +89,92 @@ data = { "financing" => true }
|
|
|
65
89
|
|
|
66
90
|
ShinyJsonLogic.apply(rule, data)
|
|
67
91
|
# => ["apr"]
|
|
68
|
-
|
|
69
92
|
```
|
|
70
93
|
|
|
71
|
-
|
|
94
|
+
---
|
|
72
95
|
|
|
73
|
-
|
|
96
|
+
## Supported operators
|
|
74
97
|
|
|
75
|
-
|
|
98
|
+
Our goal is **full JSON Logic coverage**.
|
|
99
|
+
Currently implemented operators include:
|
|
76
100
|
|
|
77
|
-
|
|
101
|
+
### Logic
|
|
102
|
+
`if`, `and`, `or`, `!`, `!!`
|
|
78
103
|
|
|
79
|
-
|
|
104
|
+
### Comparison
|
|
105
|
+
`==`, `===`, `!=`, `!==`, `>`, `>=`, `<`, `<=`
|
|
80
106
|
|
|
81
|
-
|
|
107
|
+
### Data access
|
|
108
|
+
`var`, `missing`, `missing_some`, `val`β¨, `exists`β¨
|
|
82
109
|
|
|
83
|
-
|
|
110
|
+
### Math
|
|
111
|
+
`+`, `-`, `*`, `/`, `%`, `min`, `max`
|
|
84
112
|
|
|
85
|
-
|
|
113
|
+
### Strings
|
|
114
|
+
`cat`, `substr`
|
|
86
115
|
|
|
87
|
-
|
|
116
|
+
### Arrays
|
|
117
|
+
`merge`, `in`, `??`β¨ *(coalesce operator)*
|
|
88
118
|
|
|
89
|
-
|
|
90
|
-
`
|
|
119
|
+
### Iterable operations
|
|
120
|
+
`map, reduce, filter, some, all, none`
|
|
91
121
|
|
|
92
|
-
|
|
122
|
+
π **Note:**
|
|
123
|
+
`val`, `exists` and `??` are **only supported by ShinyJsonLogic** at the moment.
|
|
93
124
|
|
|
94
|
-
`
|
|
125
|
+
(See `lib/shiny_json_logic/operations` for the authoritative list.)
|
|
95
126
|
|
|
96
|
-
|
|
127
|
+
---
|
|
97
128
|
|
|
98
|
-
|
|
129
|
+
## Compatibility
|
|
99
130
|
|
|
100
|
-
|
|
101
|
-
|
|
131
|
+
ShinyJsonLogic is designed to track the official JSON Logic specification as closely as possible.
|
|
132
|
+
|
|
133
|
+
A compatibility PR against the JSON Logic test tables is currently in progress and will be linked here once merged.
|
|
102
134
|
|
|
103
|
-
|
|
135
|
+
---
|
|
104
136
|
|
|
105
137
|
## Development
|
|
106
138
|
|
|
107
139
|
After checking out the repo:
|
|
108
140
|
|
|
109
|
-
```
|
|
141
|
+
```bash
|
|
110
142
|
bin/setup
|
|
111
143
|
bundle exec rspec
|
|
112
144
|
```
|
|
113
145
|
|
|
114
|
-
|
|
146
|
+
Open a console:
|
|
115
147
|
|
|
116
|
-
```
|
|
148
|
+
```bash
|
|
117
149
|
bin/console
|
|
118
150
|
```
|
|
119
151
|
|
|
120
|
-
|
|
152
|
+
Install locally:
|
|
121
153
|
|
|
122
|
-
```
|
|
154
|
+
```bash
|
|
123
155
|
bundle exec rake install
|
|
124
156
|
```
|
|
125
157
|
|
|
158
|
+
---
|
|
159
|
+
|
|
126
160
|
## Contributing
|
|
127
161
|
|
|
128
162
|
Contributions are welcome β especially:
|
|
129
163
|
|
|
130
|
-
spec alignment improvements
|
|
164
|
+
- spec alignment improvements
|
|
165
|
+
- missing operators
|
|
166
|
+
- edge-case tests
|
|
167
|
+
- performance improvements
|
|
131
168
|
|
|
132
169
|
Please include tests with any change.
|
|
133
170
|
|
|
134
|
-
Repository:
|
|
171
|
+
Repository:
|
|
172
|
+
https://github.com/luismoyano/shiny_json_logic
|
|
173
|
+
|
|
174
|
+
---
|
|
135
175
|
|
|
136
176
|
## License
|
|
137
177
|
|
|
138
178
|
MIT License.
|
|
139
179
|
|
|
140
|
-
Use it
|
|
180
|
+
Use it. Fork it. Ship it. (:
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
require "core_ext/array"
|
|
2
|
+
require "core_ext/hash"
|
|
3
|
+
Dir[File.join(__dir__, "operations/**/*.rb")].each do |file|
|
|
4
|
+
require file
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
module ShinyJsonLogic
|
|
8
|
+
class Engine
|
|
9
|
+
def initialize(rule, data = {})
|
|
10
|
+
@rule = rule
|
|
11
|
+
@data = data
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def call
|
|
15
|
+
stack = [[rule, data, :enter]]
|
|
16
|
+
results = []
|
|
17
|
+
|
|
18
|
+
while stack.any?
|
|
19
|
+
node, ctx, state = stack.pop
|
|
20
|
+
|
|
21
|
+
if state == :exit
|
|
22
|
+
# Already evaluated children, we solve
|
|
23
|
+
if node.is_a?(Hash)
|
|
24
|
+
op, raw_args = node.to_a.first
|
|
25
|
+
|
|
26
|
+
if collection_solvers.key?(op)
|
|
27
|
+
results << collection_solvers.fetch(op).new(raw_args, ctx).call
|
|
28
|
+
else
|
|
29
|
+
if raw_args.is_a?(Array)
|
|
30
|
+
argc = raw_args.size
|
|
31
|
+
args = results.pop(argc)
|
|
32
|
+
results << solvers.fetch(op).new(args, ctx).call
|
|
33
|
+
else
|
|
34
|
+
args = Array.wrap(results.pop)
|
|
35
|
+
results << solvers.fetch(op).new(args, ctx).call
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
elsif node.is_a?(Array)
|
|
39
|
+
results << results.pop(node.size)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
next
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# ENTER phase
|
|
46
|
+
case node
|
|
47
|
+
when Hash
|
|
48
|
+
op, raw_args = node.to_a.first
|
|
49
|
+
|
|
50
|
+
stack << [node, ctx, :exit]
|
|
51
|
+
|
|
52
|
+
unless collection_solvers.key?(op)
|
|
53
|
+
if raw_args.is_a?(Array)
|
|
54
|
+
raw_args.reverse_each { |a| stack << [a, ctx, :enter] }
|
|
55
|
+
else
|
|
56
|
+
stack << [raw_args, ctx, :enter]
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
when Array
|
|
61
|
+
stack << [node, ctx, :exit]
|
|
62
|
+
node.reverse_each { |n| stack << [n, ctx, :enter] }
|
|
63
|
+
|
|
64
|
+
else
|
|
65
|
+
results << node
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
results.last
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
attr_reader :rule, :data
|
|
75
|
+
|
|
76
|
+
def solvers
|
|
77
|
+
@@solvers ||= {
|
|
78
|
+
"var" => Operations::Var,
|
|
79
|
+
"missing" => Operations::Missing,
|
|
80
|
+
"missing_some" => Operations::MissingSome,
|
|
81
|
+
"if" => Operations::If,
|
|
82
|
+
"==" => Operations::Equal,
|
|
83
|
+
"===" => Operations::StrictEqual,
|
|
84
|
+
"!=" => Operations::Different,
|
|
85
|
+
"!==" => Operations::StrictDifferent,
|
|
86
|
+
">" => Operations::Greater,
|
|
87
|
+
">=" => Operations::GreaterEqual,
|
|
88
|
+
"<" => Operations::Smaller,
|
|
89
|
+
"<=" => Operations::SmallerEqual,
|
|
90
|
+
"!" => Operations::Not,
|
|
91
|
+
"or" => Operations::Or,
|
|
92
|
+
"and" => Operations::And,
|
|
93
|
+
"?:" => Operations::If,
|
|
94
|
+
"in" => Operations::Inclusion,
|
|
95
|
+
"cat" => Operations::Concatenation,
|
|
96
|
+
"%" => Operations::Modulo,
|
|
97
|
+
"max" => Operations::Max,
|
|
98
|
+
"min" => Operations::Min,
|
|
99
|
+
"+" => Operations::Addition,
|
|
100
|
+
"*" => Operations::Product,
|
|
101
|
+
"-" => Operations::Subtraction,
|
|
102
|
+
"/" => Operations::Division,
|
|
103
|
+
"substr" => Operations::Substring,
|
|
104
|
+
"merge" => Operations::Merge,
|
|
105
|
+
"!!" => Operations::DoubleNot,
|
|
106
|
+
"val" => Operations::Val,
|
|
107
|
+
"??" => Operations::Coalesce,
|
|
108
|
+
"exists" => Operations::Exists,
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def collection_solvers
|
|
113
|
+
@@collection_solvers ||= {
|
|
114
|
+
"filter" => Operations::Filter,
|
|
115
|
+
"map" => Operations::Map,
|
|
116
|
+
"reduce" => Operations::Reduce,
|
|
117
|
+
"all" => Operations::All,
|
|
118
|
+
"none" => Operations::None,
|
|
119
|
+
"some" => Operations::Some,
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require "shiny_json_logic/operations/base"
|
|
2
|
+
|
|
3
|
+
module ShinyJsonLogic
|
|
4
|
+
module Operations
|
|
5
|
+
class Exists < Base
|
|
6
|
+
def call
|
|
7
|
+
current = data
|
|
8
|
+
|
|
9
|
+
Array.wrap(rules).each do |segment|
|
|
10
|
+
return false unless current.key?(segment)
|
|
11
|
+
|
|
12
|
+
current = current[segment]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
true
|
|
16
|
+
rescue
|
|
17
|
+
false
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/shiny_json_logic.rb
CHANGED
|
@@ -1,106 +1,8 @@
|
|
|
1
1
|
require "shiny_json_logic/version"
|
|
2
|
-
require "
|
|
3
|
-
require "core_ext/hash"
|
|
4
|
-
require "shiny_json_logic/operations/var"
|
|
5
|
-
require "shiny_json_logic/operations/missing"
|
|
6
|
-
require "shiny_json_logic/operations/missing_some"
|
|
7
|
-
require "shiny_json_logic/operations/if"
|
|
8
|
-
require "shiny_json_logic/operations/equal"
|
|
9
|
-
require "shiny_json_logic/operations/strict_equal"
|
|
10
|
-
require "shiny_json_logic/operations/different"
|
|
11
|
-
require "shiny_json_logic/operations/strict_different"
|
|
12
|
-
require "shiny_json_logic/operations/greater"
|
|
13
|
-
require "shiny_json_logic/operations/greater_equal"
|
|
14
|
-
require "shiny_json_logic/operations/smaller"
|
|
15
|
-
require "shiny_json_logic/operations/smaller_equal"
|
|
16
|
-
require "shiny_json_logic/operations/not"
|
|
17
|
-
require "shiny_json_logic/operations/or"
|
|
18
|
-
require "shiny_json_logic/operations/and"
|
|
19
|
-
require "shiny_json_logic/operations/inclusion"
|
|
20
|
-
require "shiny_json_logic/operations/concatenation"
|
|
21
|
-
require "shiny_json_logic/operations/modulo"
|
|
22
|
-
require "shiny_json_logic/operations/max"
|
|
23
|
-
require "shiny_json_logic/operations/min"
|
|
24
|
-
require "shiny_json_logic/operations/addition"
|
|
25
|
-
require "shiny_json_logic/operations/product"
|
|
26
|
-
require "shiny_json_logic/operations/subtraction"
|
|
27
|
-
require "shiny_json_logic/operations/division"
|
|
28
|
-
require "shiny_json_logic/operations/substring"
|
|
29
|
-
require "shiny_json_logic/operations/merge"
|
|
30
|
-
require "shiny_json_logic/operations/double_not"
|
|
31
|
-
require "shiny_json_logic/operations/filter"
|
|
32
|
-
require "shiny_json_logic/operations/map"
|
|
33
|
-
require "shiny_json_logic/operations/reduce"
|
|
34
|
-
require "shiny_json_logic/operations/all"
|
|
35
|
-
require "shiny_json_logic/operations/none"
|
|
36
|
-
require "shiny_json_logic/operations/some"
|
|
2
|
+
require "shiny_json_logic/engine"
|
|
37
3
|
|
|
38
4
|
module ShinyJsonLogic
|
|
39
|
-
class Error < StandardError; end
|
|
40
|
-
|
|
41
5
|
def self.apply(rule, data = {})
|
|
42
|
-
|
|
43
|
-
operation, raw_args = rule.to_a.first
|
|
44
|
-
if collection_solvers.key?(operation)
|
|
45
|
-
collection_solvers.fetch(operation).new(raw_args, data).call
|
|
46
|
-
else
|
|
47
|
-
evaluated_args =
|
|
48
|
-
if raw_args.is_a?(Array)
|
|
49
|
-
raw_args.map { |val| apply(val, data) }
|
|
50
|
-
else
|
|
51
|
-
Array.wrap(apply(raw_args, data))
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
solvers.fetch(operation).new(evaluated_args, data).call
|
|
55
|
-
end
|
|
56
|
-
elsif rule.is_a?(Array)
|
|
57
|
-
rule.map { |item| apply(item, data) }
|
|
58
|
-
else
|
|
59
|
-
rule
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def self.solvers
|
|
64
|
-
{
|
|
65
|
-
"var" => Operations::Var,
|
|
66
|
-
"missing" => Operations::Missing,
|
|
67
|
-
"missing_some" => Operations::MissingSome,
|
|
68
|
-
"if" => Operations::If,
|
|
69
|
-
"==" => Operations::Equal,
|
|
70
|
-
"===" => Operations::StrictEqual,
|
|
71
|
-
"!=" => Operations::Different,
|
|
72
|
-
"!==" => Operations::StrictDifferent,
|
|
73
|
-
">" => Operations::Greater,
|
|
74
|
-
">=" => Operations::GreaterEqual,
|
|
75
|
-
"<" => Operations::Smaller,
|
|
76
|
-
"<=" => Operations::SmallerEqual,
|
|
77
|
-
"!" => Operations::Not,
|
|
78
|
-
"or" => Operations::Or,
|
|
79
|
-
"and" => Operations::And,
|
|
80
|
-
"?:" => Operations::If,
|
|
81
|
-
"in" => Operations::Inclusion,
|
|
82
|
-
"cat" => Operations::Concatenation,
|
|
83
|
-
"%" => Operations::Modulo,
|
|
84
|
-
"max" => Operations::Max,
|
|
85
|
-
"min" => Operations::Min,
|
|
86
|
-
"+" => Operations::Addition,
|
|
87
|
-
"*" => Operations::Product,
|
|
88
|
-
"-" => Operations::Subtraction,
|
|
89
|
-
"/" => Operations::Division,
|
|
90
|
-
"substr" => Operations::Substring,
|
|
91
|
-
"merge" => Operations::Merge,
|
|
92
|
-
"!!" => Operations::DoubleNot,
|
|
93
|
-
}
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def self.collection_solvers
|
|
97
|
-
{
|
|
98
|
-
"filter" => Operations::Filter,
|
|
99
|
-
"map" => Operations::Map,
|
|
100
|
-
"reduce" => Operations::Reduce,
|
|
101
|
-
"all" => Operations::All,
|
|
102
|
-
"none" => Operations::None,
|
|
103
|
-
"some" => Operations::Some,
|
|
104
|
-
}
|
|
6
|
+
Engine.new(rule, data).call
|
|
105
7
|
end
|
|
106
8
|
end
|
data/shiny_json_logic.gemspec
CHANGED
|
@@ -9,24 +9,42 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = ["Luis Moyano"]
|
|
10
10
|
spec.email = ["moyano@hey.com"]
|
|
11
11
|
|
|
12
|
-
spec.summary
|
|
13
|
-
spec.description
|
|
12
|
+
spec.summary = "Production-ready JSON Logic for Ruby that just works: zero deps, Ruby 2.7+, high spec alignment."
|
|
13
|
+
spec.description = <<~DESC
|
|
14
|
+
ShinyJsonLogic is a pure-Ruby, zero-runtime-dependency implementation of the JSON Logic specification.
|
|
15
|
+
|
|
16
|
+
- Ruby 2.7+ compatible
|
|
17
|
+
- Actively maintained and test-driven
|
|
18
|
+
- Designed for spec alignment and predictable behavior
|
|
19
|
+
- Highest support for JSON Logic operations within the Ruby ecosystem
|
|
20
|
+
|
|
21
|
+
JSON Logic lets you represent decisions as data, so rules can be stored, transmitted, and evaluated safely.
|
|
22
|
+
DESC
|
|
14
23
|
spec.homepage = "https://github.com/luismoyano/shiny-json-logic-ruby"
|
|
15
24
|
spec.license = "MIT"
|
|
16
25
|
|
|
26
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
27
|
+
|
|
28
|
+
spec.metadata = {
|
|
29
|
+
"homepage_uri" => spec.homepage,
|
|
30
|
+
"source_code_uri" => spec.homepage,
|
|
31
|
+
"documentation_uri" => "#{spec.homepage}#readme",
|
|
32
|
+
"changelog_uri" => "#{spec.homepage}/blob/main/CHANGELOG.md",
|
|
33
|
+
"rubygems_mfa_required" => "true"
|
|
34
|
+
}
|
|
35
|
+
|
|
17
36
|
# Specify which files should be added to the gem when it is released.
|
|
18
37
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
19
38
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
20
39
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
21
40
|
end
|
|
22
41
|
|
|
23
|
-
spec.add_runtime_dependency 'backport_dig' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
|
|
24
42
|
spec.bindir = "exe"
|
|
25
43
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
44
|
spec.require_paths = ["lib"]
|
|
27
45
|
|
|
28
|
-
spec.add_development_dependency "bundler"
|
|
29
|
-
spec.add_development_dependency "rake"
|
|
46
|
+
spec.add_development_dependency "bundler"
|
|
47
|
+
spec.add_development_dependency "rake"
|
|
30
48
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
31
49
|
spec.add_development_dependency 'byebug'
|
|
32
50
|
spec.add_development_dependency 'pry'
|
metadata
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shiny_json_logic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luis Moyano
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-01-25 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: bundler
|
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
|
15
16
|
requirements:
|
|
16
|
-
- - "
|
|
17
|
+
- - ">="
|
|
17
18
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
19
|
+
version: '0'
|
|
19
20
|
type: :development
|
|
20
21
|
prerelease: false
|
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
23
|
requirements:
|
|
23
|
-
- - "
|
|
24
|
+
- - ">="
|
|
24
25
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
26
|
+
version: '0'
|
|
26
27
|
- !ruby/object:Gem::Dependency
|
|
27
28
|
name: rake
|
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
|
29
30
|
requirements:
|
|
30
|
-
- - "
|
|
31
|
+
- - ">="
|
|
31
32
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
33
|
+
version: '0'
|
|
33
34
|
type: :development
|
|
34
35
|
prerelease: false
|
|
35
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
37
|
requirements:
|
|
37
|
-
- - "
|
|
38
|
+
- - ">="
|
|
38
39
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
40
|
+
version: '0'
|
|
40
41
|
- !ruby/object:Gem::Dependency
|
|
41
42
|
name: rspec
|
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -79,11 +80,15 @@ dependencies:
|
|
|
79
80
|
- - ">="
|
|
80
81
|
- !ruby/object:Gem::Version
|
|
81
82
|
version: '0'
|
|
82
|
-
description:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
description: |
|
|
84
|
+
ShinyJsonLogic is a pure-Ruby, zero-runtime-dependency implementation of the JSON Logic specification.
|
|
85
|
+
|
|
86
|
+
- Ruby 2.7+ compatible
|
|
87
|
+
- Actively maintained and test-driven
|
|
88
|
+
- Designed for spec alignment and predictable behavior
|
|
89
|
+
- Highest support for JSON Logic operations within the Ruby ecosystem
|
|
90
|
+
|
|
91
|
+
JSON Logic lets you represent decisions as data, so rules can be stored, transmitted, and evaluated safely.
|
|
87
92
|
email:
|
|
88
93
|
- moyano@hey.com
|
|
89
94
|
executables: []
|
|
@@ -97,6 +102,7 @@ files:
|
|
|
97
102
|
- ".idea/vcs.xml"
|
|
98
103
|
- ".rspec"
|
|
99
104
|
- ".travis.yml"
|
|
105
|
+
- CHANGELOG.md
|
|
100
106
|
- Gemfile
|
|
101
107
|
- Gemfile.lock
|
|
102
108
|
- LICENSE.txt
|
|
@@ -107,15 +113,18 @@ files:
|
|
|
107
113
|
- lib/core_ext/array.rb
|
|
108
114
|
- lib/core_ext/hash.rb
|
|
109
115
|
- lib/shiny_json_logic.rb
|
|
116
|
+
- lib/shiny_json_logic/engine.rb
|
|
110
117
|
- lib/shiny_json_logic/operations/addition.rb
|
|
111
118
|
- lib/shiny_json_logic/operations/all.rb
|
|
112
119
|
- lib/shiny_json_logic/operations/and.rb
|
|
113
120
|
- lib/shiny_json_logic/operations/base.rb
|
|
121
|
+
- lib/shiny_json_logic/operations/coalesce.rb
|
|
114
122
|
- lib/shiny_json_logic/operations/concatenation.rb
|
|
115
123
|
- lib/shiny_json_logic/operations/different.rb
|
|
116
124
|
- lib/shiny_json_logic/operations/division.rb
|
|
117
125
|
- lib/shiny_json_logic/operations/double_not.rb
|
|
118
126
|
- lib/shiny_json_logic/operations/equal.rb
|
|
127
|
+
- lib/shiny_json_logic/operations/exists.rb
|
|
119
128
|
- lib/shiny_json_logic/operations/filter.rb
|
|
120
129
|
- lib/shiny_json_logic/operations/greater.rb
|
|
121
130
|
- lib/shiny_json_logic/operations/greater_equal.rb
|
|
@@ -141,6 +150,7 @@ files:
|
|
|
141
150
|
- lib/shiny_json_logic/operations/strict_equal.rb
|
|
142
151
|
- lib/shiny_json_logic/operations/substring.rb
|
|
143
152
|
- lib/shiny_json_logic/operations/subtraction.rb
|
|
153
|
+
- lib/shiny_json_logic/operations/val.rb
|
|
144
154
|
- lib/shiny_json_logic/operations/var.rb
|
|
145
155
|
- lib/shiny_json_logic/truthy.rb
|
|
146
156
|
- lib/shiny_json_logic/version.rb
|
|
@@ -148,7 +158,13 @@ files:
|
|
|
148
158
|
homepage: https://github.com/luismoyano/shiny-json-logic-ruby
|
|
149
159
|
licenses:
|
|
150
160
|
- MIT
|
|
151
|
-
metadata:
|
|
161
|
+
metadata:
|
|
162
|
+
homepage_uri: https://github.com/luismoyano/shiny-json-logic-ruby
|
|
163
|
+
source_code_uri: https://github.com/luismoyano/shiny-json-logic-ruby
|
|
164
|
+
documentation_uri: https://github.com/luismoyano/shiny-json-logic-ruby#readme
|
|
165
|
+
changelog_uri: https://github.com/luismoyano/shiny-json-logic-ruby/blob/main/CHANGELOG.md
|
|
166
|
+
rubygems_mfa_required: 'true'
|
|
167
|
+
post_install_message:
|
|
152
168
|
rdoc_options: []
|
|
153
169
|
require_paths:
|
|
154
170
|
- lib
|
|
@@ -156,14 +172,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
156
172
|
requirements:
|
|
157
173
|
- - ">="
|
|
158
174
|
- !ruby/object:Gem::Version
|
|
159
|
-
version:
|
|
175
|
+
version: 2.7.0
|
|
160
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
177
|
requirements:
|
|
162
178
|
- - ">="
|
|
163
179
|
- !ruby/object:Gem::Version
|
|
164
180
|
version: '0'
|
|
165
181
|
requirements: []
|
|
166
|
-
rubygems_version: 3.6
|
|
182
|
+
rubygems_version: 3.1.6
|
|
183
|
+
signing_key:
|
|
167
184
|
specification_version: 4
|
|
168
|
-
summary:
|
|
185
|
+
summary: 'Production-ready JSON Logic for Ruby that just works: zero deps, Ruby 2.7+,
|
|
186
|
+
high spec alignment.'
|
|
169
187
|
test_files: []
|