diff --git a/lib/json_logic/operation.rb b/lib/json_logic/operation.rb index be8a972..a39a4f6 100644 --- a/lib/json_logic/operation.rb +++ b/lib/json_logic/operation.rb @@ -93,8 +93,8 @@ class Operation '!!' => ->(v, d) { v[0].truthy? }, 'or' => ->(v, d) { v.find(&:truthy?) || v.last }, 'and' => ->(v, d) { - result = v.find(&:falsy?) - result.nil? ? v.last : result + idx = v.index(&:falsy?) + idx.nil? ? v.last : v[idx] }, '?:' => ->(v, d) { LAMBDAS['if'].call(v, d) }, '>' => ->(v, d) { v.map(&:to_f).each_cons(2).all? { |i, j| i > j } },