shiny_json_logic 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 +7 -0
- data/.gitignore +20 -0
- data/.idea/.gitignore +8 -0
- data/.idea/modules.xml +8 -0
- data/.idea/shiny_json_logic.iml +55 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +43 -0
- data/LICENSE.txt +21 -0
- data/README.md +140 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/core_ext/array.rb +16 -0
- data/lib/core_ext/hash.rb +7 -0
- data/lib/shiny_json_logic/operations/addition.rb +11 -0
- data/lib/shiny_json_logic/operations/all.rb +20 -0
- data/lib/shiny_json_logic/operations/and.rb +12 -0
- data/lib/shiny_json_logic/operations/base.rb +21 -0
- data/lib/shiny_json_logic/operations/concatenation.rb +13 -0
- data/lib/shiny_json_logic/operations/different.rb +12 -0
- data/lib/shiny_json_logic/operations/division.rb +11 -0
- data/lib/shiny_json_logic/operations/double_not.rb +12 -0
- data/lib/shiny_json_logic/operations/equal.rb +11 -0
- data/lib/shiny_json_logic/operations/filter.rb +18 -0
- data/lib/shiny_json_logic/operations/greater.rb +11 -0
- data/lib/shiny_json_logic/operations/greater_equal.rb +11 -0
- data/lib/shiny_json_logic/operations/if.rb +17 -0
- data/lib/shiny_json_logic/operations/inclusion.rb +11 -0
- data/lib/shiny_json_logic/operations/iterable/base.rb +50 -0
- data/lib/shiny_json_logic/operations/map.rb +14 -0
- data/lib/shiny_json_logic/operations/max.rb +11 -0
- data/lib/shiny_json_logic/operations/merge.rb +11 -0
- data/lib/shiny_json_logic/operations/min.rb +11 -0
- data/lib/shiny_json_logic/operations/missing.rb +22 -0
- data/lib/shiny_json_logic/operations/missing_some.rb +15 -0
- data/lib/shiny_json_logic/operations/modulo.rb +11 -0
- data/lib/shiny_json_logic/operations/none.rb +20 -0
- data/lib/shiny_json_logic/operations/not.rb +12 -0
- data/lib/shiny_json_logic/operations/or.rb +12 -0
- data/lib/shiny_json_logic/operations/product.rb +11 -0
- data/lib/shiny_json_logic/operations/reduce.rb +34 -0
- data/lib/shiny_json_logic/operations/smaller.rb +11 -0
- data/lib/shiny_json_logic/operations/smaller_equal.rb +11 -0
- data/lib/shiny_json_logic/operations/some.rb +18 -0
- data/lib/shiny_json_logic/operations/strict_different.rb +12 -0
- data/lib/shiny_json_logic/operations/strict_equal.rb +15 -0
- data/lib/shiny_json_logic/operations/substring.rb +16 -0
- data/lib/shiny_json_logic/operations/subtraction.rb +12 -0
- data/lib/shiny_json_logic/operations/var.rb +20 -0
- data/lib/shiny_json_logic/truthy.rb +14 -0
- data/lib/shiny_json_logic/version.rb +3 -0
- data/lib/shiny_json_logic.rb +106 -0
- data/shiny_json_logic.gemspec +33 -0
- metadata +169 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/iterable/base"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class Map < Iterable::Base
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def on_each(_item)
|
|
10
|
+
ShinyJsonLogic.apply(filter, data)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/base"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class Missing < Base
|
|
7
|
+
def call
|
|
8
|
+
return rules unless data.is_a?(Hash) && rules.is_a?(Array)
|
|
9
|
+
|
|
10
|
+
rules - deep_keys(data)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def deep_keys(hash)
|
|
16
|
+
return unless hash.is_a?(Hash)
|
|
17
|
+
|
|
18
|
+
hash.keys.map{|key| ([key] << deep_keys(hash[key])).compact.join(".") }
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/missing"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class MissingSome < Missing
|
|
7
|
+
def call
|
|
8
|
+
return rules[1] unless data.is_a?(Hash) && rules.is_a?(Array)
|
|
9
|
+
|
|
10
|
+
present = rules[1] & data.keys
|
|
11
|
+
present.size >= rules[0] ? [] : Missing.new(rules[1], data).call
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/iterable/base"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class None < Iterable::Base
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def on_each(_item)
|
|
10
|
+
ShinyJsonLogic.apply(filter, data)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def on_after(results)
|
|
14
|
+
return true if results.empty?
|
|
15
|
+
|
|
16
|
+
results.all? { |res| res == false }
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/iterable/base"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class Reduce < Iterable::Base
|
|
7
|
+
def initialize(rules, data)
|
|
8
|
+
super
|
|
9
|
+
@accumulator = ShinyJsonLogic.apply(rules[2], data) # third argument
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
attr_accessor :accumulator
|
|
15
|
+
|
|
16
|
+
def on_before_each(_item)
|
|
17
|
+
super
|
|
18
|
+
data["accumulator"] = accumulator
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def on_each(_item)
|
|
22
|
+
self.accumulator = ShinyJsonLogic.apply(filter, data)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def on_after(_results)
|
|
26
|
+
self.accumulator
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def current_key
|
|
30
|
+
"current"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/iterable/base"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class Some < Iterable::Base
|
|
7
|
+
private
|
|
8
|
+
|
|
9
|
+
def on_each(_item)
|
|
10
|
+
ShinyJsonLogic.apply(filter, data)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def on_after(results)
|
|
14
|
+
results.any? { |res| res == true }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require "shiny_json_logic/operations/base"
|
|
2
|
+
require "shiny_json_logic/operations/strict_equal"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class StrictDifferent < Base
|
|
7
|
+
def call
|
|
8
|
+
!Operations::StrictEqual.new(rules, data).call
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "shiny_json_logic/operations/base"
|
|
2
|
+
|
|
3
|
+
module ShinyJsonLogic
|
|
4
|
+
module Operations
|
|
5
|
+
class StrictEqual < Base
|
|
6
|
+
def call
|
|
7
|
+
casted = rules.map do |value|
|
|
8
|
+
(value.is_a?(Numeric) ? value.to_f : value).to_s
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
casted.all? { |v| v == casted[0] }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "shiny_json_logic/operations/base"
|
|
2
|
+
|
|
3
|
+
module ShinyJsonLogic
|
|
4
|
+
module Operations
|
|
5
|
+
class Substring < Base
|
|
6
|
+
def call
|
|
7
|
+
str, start = rules[0].to_s, rules[1].to_i
|
|
8
|
+
length = rules.fetch(2, str.length).to_i
|
|
9
|
+
start += str.length if start < 0
|
|
10
|
+
finish = length < 0 ? str.length + length : start + length
|
|
11
|
+
|
|
12
|
+
str[start...finish]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "shiny_json_logic/truthy"
|
|
2
|
+
require "shiny_json_logic/operations/base"
|
|
3
|
+
|
|
4
|
+
module ShinyJsonLogic
|
|
5
|
+
module Operations
|
|
6
|
+
class Var < Base
|
|
7
|
+
def call
|
|
8
|
+
key = rules.is_a?(Array) ? rules[0] : rules
|
|
9
|
+
default = rules.is_a?(Array) ? rules[1] : nil
|
|
10
|
+
|
|
11
|
+
return data if key.nil?
|
|
12
|
+
|
|
13
|
+
data&.deep_fetch(*Array.wrap(key)) || default
|
|
14
|
+
rescue
|
|
15
|
+
default || data
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# https://jsonlogic.com/truthy.html
|
|
2
|
+
|
|
3
|
+
module ShinyJsonLogic
|
|
4
|
+
module Truthy
|
|
5
|
+
def self.call(subject)
|
|
6
|
+
return subject if [true, false].include? subject
|
|
7
|
+
return !subject.zero? if subject.is_a? Numeric
|
|
8
|
+
return subject.any? if subject.is_a? Array
|
|
9
|
+
return !subject.empty? if subject.is_a? String
|
|
10
|
+
|
|
11
|
+
!subject.nil?
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
require "shiny_json_logic/version"
|
|
2
|
+
require "core_ext/array"
|
|
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"
|
|
37
|
+
|
|
38
|
+
module ShinyJsonLogic
|
|
39
|
+
class Error < StandardError; end
|
|
40
|
+
|
|
41
|
+
def self.apply(rule, data = {})
|
|
42
|
+
if rule.is_a?(Hash)
|
|
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
|
+
}
|
|
105
|
+
end
|
|
106
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "shiny_json_logic/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "shiny_json_logic"
|
|
8
|
+
spec.version = ShinyJsonLogic::VERSION
|
|
9
|
+
spec.authors = ["Luis Moyano"]
|
|
10
|
+
spec.email = ["moyano@hey.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{An implementation of JSON Logic in Ruby that works.}
|
|
13
|
+
spec.description = %q{JsonLogic isn’t a full programming language. It’s a small, safe way to delegate one decision. You could store a rule in a database to decide later. You could send that rule from back-end to front-end so the decision is made immediately from user input. Because the rule is data, you can even build it dynamically from user actions or GUI input. See http://jsonlogic.com}
|
|
14
|
+
spec.homepage = "https://github.com/luismoyano/shiny_json_logic"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
spec.add_runtime_dependency 'backport_dig' if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
|
|
24
|
+
spec.bindir = "exe"
|
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
|
+
spec.require_paths = ["lib"]
|
|
27
|
+
|
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
31
|
+
spec.add_development_dependency 'byebug'
|
|
32
|
+
spec.add_development_dependency 'pry'
|
|
33
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: shiny_json_logic
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Luis Moyano
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: bundler
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.17'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.17'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rake
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '10.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '10.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rspec
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.0'
|
|
47
|
+
type: :development
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '3.0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: byebug
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: pry
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
description: JsonLogic isn’t a full programming language. It’s a small, safe way to
|
|
83
|
+
delegate one decision. You could store a rule in a database to decide later. You
|
|
84
|
+
could send that rule from back-end to front-end so the decision is made immediately
|
|
85
|
+
from user input. Because the rule is data, you can even build it dynamically from
|
|
86
|
+
user actions or GUI input. See http://jsonlogic.com
|
|
87
|
+
email:
|
|
88
|
+
- moyano@hey.com
|
|
89
|
+
executables: []
|
|
90
|
+
extensions: []
|
|
91
|
+
extra_rdoc_files: []
|
|
92
|
+
files:
|
|
93
|
+
- ".gitignore"
|
|
94
|
+
- ".idea/.gitignore"
|
|
95
|
+
- ".idea/modules.xml"
|
|
96
|
+
- ".idea/shiny_json_logic.iml"
|
|
97
|
+
- ".idea/vcs.xml"
|
|
98
|
+
- ".rspec"
|
|
99
|
+
- ".travis.yml"
|
|
100
|
+
- Gemfile
|
|
101
|
+
- Gemfile.lock
|
|
102
|
+
- LICENSE.txt
|
|
103
|
+
- README.md
|
|
104
|
+
- Rakefile
|
|
105
|
+
- bin/console
|
|
106
|
+
- bin/setup
|
|
107
|
+
- lib/core_ext/array.rb
|
|
108
|
+
- lib/core_ext/hash.rb
|
|
109
|
+
- lib/shiny_json_logic.rb
|
|
110
|
+
- lib/shiny_json_logic/operations/addition.rb
|
|
111
|
+
- lib/shiny_json_logic/operations/all.rb
|
|
112
|
+
- lib/shiny_json_logic/operations/and.rb
|
|
113
|
+
- lib/shiny_json_logic/operations/base.rb
|
|
114
|
+
- lib/shiny_json_logic/operations/concatenation.rb
|
|
115
|
+
- lib/shiny_json_logic/operations/different.rb
|
|
116
|
+
- lib/shiny_json_logic/operations/division.rb
|
|
117
|
+
- lib/shiny_json_logic/operations/double_not.rb
|
|
118
|
+
- lib/shiny_json_logic/operations/equal.rb
|
|
119
|
+
- lib/shiny_json_logic/operations/filter.rb
|
|
120
|
+
- lib/shiny_json_logic/operations/greater.rb
|
|
121
|
+
- lib/shiny_json_logic/operations/greater_equal.rb
|
|
122
|
+
- lib/shiny_json_logic/operations/if.rb
|
|
123
|
+
- lib/shiny_json_logic/operations/inclusion.rb
|
|
124
|
+
- lib/shiny_json_logic/operations/iterable/base.rb
|
|
125
|
+
- lib/shiny_json_logic/operations/map.rb
|
|
126
|
+
- lib/shiny_json_logic/operations/max.rb
|
|
127
|
+
- lib/shiny_json_logic/operations/merge.rb
|
|
128
|
+
- lib/shiny_json_logic/operations/min.rb
|
|
129
|
+
- lib/shiny_json_logic/operations/missing.rb
|
|
130
|
+
- lib/shiny_json_logic/operations/missing_some.rb
|
|
131
|
+
- lib/shiny_json_logic/operations/modulo.rb
|
|
132
|
+
- lib/shiny_json_logic/operations/none.rb
|
|
133
|
+
- lib/shiny_json_logic/operations/not.rb
|
|
134
|
+
- lib/shiny_json_logic/operations/or.rb
|
|
135
|
+
- lib/shiny_json_logic/operations/product.rb
|
|
136
|
+
- lib/shiny_json_logic/operations/reduce.rb
|
|
137
|
+
- lib/shiny_json_logic/operations/smaller.rb
|
|
138
|
+
- lib/shiny_json_logic/operations/smaller_equal.rb
|
|
139
|
+
- lib/shiny_json_logic/operations/some.rb
|
|
140
|
+
- lib/shiny_json_logic/operations/strict_different.rb
|
|
141
|
+
- lib/shiny_json_logic/operations/strict_equal.rb
|
|
142
|
+
- lib/shiny_json_logic/operations/substring.rb
|
|
143
|
+
- lib/shiny_json_logic/operations/subtraction.rb
|
|
144
|
+
- lib/shiny_json_logic/operations/var.rb
|
|
145
|
+
- lib/shiny_json_logic/truthy.rb
|
|
146
|
+
- lib/shiny_json_logic/version.rb
|
|
147
|
+
- shiny_json_logic.gemspec
|
|
148
|
+
homepage: https://github.com/luismoyano/shiny_json_logic
|
|
149
|
+
licenses:
|
|
150
|
+
- MIT
|
|
151
|
+
metadata: {}
|
|
152
|
+
rdoc_options: []
|
|
153
|
+
require_paths:
|
|
154
|
+
- lib
|
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
|
+
requirements:
|
|
162
|
+
- - ">="
|
|
163
|
+
- !ruby/object:Gem::Version
|
|
164
|
+
version: '0'
|
|
165
|
+
requirements: []
|
|
166
|
+
rubygems_version: 3.6.9
|
|
167
|
+
specification_version: 4
|
|
168
|
+
summary: An implementation of JSON Logic in Ruby that works.
|
|
169
|
+
test_files: []
|