shiny_json_logic 0.2.3 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccdacd662118213f662b622e9fa22863999631809306cbd04cd87d206989e204
4
- data.tar.gz: 41850a307b0d8b207d8c367228cc53b99dc8798223ceecc37b69722cefaf5d24
3
+ metadata.gz: e606b70876145a81ca93c1f7368b12dd721482a7307c665b2e30377397c718e9
4
+ data.tar.gz: ac30778c9cff352f359fc2c9d0645114e600d4614e04f62394a76f2557d5386d
5
5
  SHA512:
6
- metadata.gz: 7188f89ff7653be1c2fd7a2a4e63b43c7396ba3df38484848fda13ac1ca96bf31decd9979261e0fe161ea0f6923373f89ab6d826ef4e876a9ea80031e867a263
7
- data.tar.gz: 8c974ac6a5db224b036e4a0baafd6bbd513cb126505dc7c049267ff46aebde098fb04dd646025145303fe1c17acf92e91f353332f0cb0e720985bda37d5517bc
6
+ metadata.gz: 3f6628c68886607a5d509de45398483fa2e426e178d591640202f168e099b08ade0ffb635da3ed15ba3b2c5ad09383152c1e82ce50ccda845cb41273497255e3
7
+ data.tar.gz: d37947b228f16f3cf735fd3f8a761d3edb3f35aef5ae8a1a557d3930f1cdb6aa9d3b2f115a351b87fa4e48352127c81d0f70624d24a65e0c50c5a1583c8b89af
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.2.4] - 2026-02-02
6
+ ### Changed
7
+ - Improves compatibility of addition operator
8
+ - Fixed bug when attempting to evaluate empty rules.
9
+
4
10
  ## [0.2.3] - 2026-02-02
5
11
  ### Changed
6
12
  - Improves compatibility of multiplication operator
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shiny_json_logic (0.2.3)
4
+ shiny_json_logic (0.2.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/badges/compat.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "label": "compat",
4
- "message": "80.7% (909/1126)",
4
+ "message": "81.5% (918/1126)",
5
5
  "color": "red"
6
6
  }
@@ -14,6 +14,8 @@ module ShinyJsonLogic
14
14
 
15
15
  def call(rule = self.rule, data = self.data)
16
16
  if rule.is_a?(Hash)
17
+ return rule if rule.empty?
18
+
17
19
  operation, raw_args = rule.to_a.first
18
20
  if operations.collection_solvers.key?(operation)
19
21
  solve(operation, raw_args, data)
@@ -1,12 +1,31 @@
1
1
  require "shiny_json_logic/operations/base"
2
+ require "shiny_json_logic/numericals/numerify"
3
+ require "shiny_json_logic/numericals/with_error_handling"
2
4
 
3
5
  module ShinyJsonLogic
4
6
  module Operations
5
7
  class Addition < Base
8
+ include Numericals::WithErrorHandling
9
+ include Numericals::Numerify
10
+
6
11
  protected
7
12
 
8
13
  def run
9
- rules.map(&:to_f).reduce(:+)
14
+
15
+ safe_arithmetic do
16
+ return 0 if numerified.empty?
17
+
18
+ numerified.reduce(:+)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def numerify(value)
25
+ val = super
26
+ return 0 if val.nil?
27
+
28
+ val
10
29
  end
11
30
  end
12
31
  end
@@ -1,3 +1,3 @@
1
1
  module ShinyJsonLogic
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/results/ruby.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "totals": {
3
3
  "shiny_json_logic": {
4
- "passed": 918,
4
+ "passed": 938,
5
5
  "total": 1126
6
6
  }
7
7
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shiny_json_logic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Moyano