json_logic 0.3 → 0.4.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/README.md +4 -0
- data/lib/json_logic/operation.rb +2 -2
- data/lib/json_logic/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375c4179f20abd547af7992c9946a6011e536581
|
4
|
+
data.tar.gz: 85fdbfe24a920389383600f116d2866224c4b480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d785101c15e9d1da6501a0ebaba7fb3f3bd442f6aaaf1a3ec7a74039ec849adc9fb52e77be55406b5a8a0da0770d533306c1d2c730577b4365f0e24b128cad44
|
7
|
+
data.tar.gz: 51356563bb58fd56fb0c8595b93476dff9b957e9b297096bddb98b867f0c0995662a400f4442983a18700391cbf25313ebd7278519569654db4e633978806882
|
data/README.md
CHANGED
@@ -4,6 +4,10 @@ Build complex rules, serialize them as JSON, and execute them in ruby.
|
|
4
4
|
|
5
5
|
**json-logic-ruby** is a ruby parser for [JsonLogic](http://jsonlogic.com). Other libraries are available for parsing this logic for Python and JavaScript at that link!
|
6
6
|
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
`gem install json_logic`
|
10
|
+
|
7
11
|
## Why use JsonLogic?
|
8
12
|
|
9
13
|
If you're looking for a way to share logic between front-end and back-end code, and even store it in a database, JsonLogic might be a fit for you.
|
data/lib/json_logic/operation.rb
CHANGED
@@ -118,13 +118,13 @@ module JSONLogic
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def self.is_standard?(operator)
|
121
|
-
LAMBDAS.
|
121
|
+
LAMBDAS.key?(operator.to_s)
|
122
122
|
end
|
123
123
|
|
124
124
|
# Determine if values associated with operator need to be re-interpreted for each iteration(ie some kind of iterator)
|
125
125
|
# or if values can just be evaluated before passing in.
|
126
126
|
def self.is_iterable?(operator)
|
127
|
-
['filter', 'some', 'all', 'none', 'in', 'map', 'reduce'].
|
127
|
+
['filter', 'some', 'all', 'none', 'in', 'map', 'reduce'].include?(operator.to_s)
|
128
128
|
end
|
129
129
|
|
130
130
|
def self.add_operation(operator, function)
|
data/lib/json_logic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenneth Geerts
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
101
|
+
rubygems_version: 2.6.14
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Build complex rules, serialize them as JSON, and execute them in ruby
|