Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/json_logic/operations/gt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@

class JsonLogic::Operations::GT < JsonLogic::Operation
def self.name = ">"
def call((a,b), _data) = a > b

def call(values, _data)
return values[0] > values[1] if values.size == 2
values.each_cons(2).all? { |a,b| a > b }
end
end
5 changes: 3 additions & 2 deletions lib/json_logic/operations/gte.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
class JsonLogic::Operations::GTE < JsonLogic::Operation
def self.name = ">="

def call((a,b), _data)
a >= b
def call(values, _data)
return values[0] >= values[1] if values.size == 2
values.each_cons(2).all? { |a,b| a >= b }
end
end
2 changes: 1 addition & 1 deletion lib/json_logic/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

module JsonLogic; VERSION = '0.1.3'; end
module JsonLogic; VERSION = '0.1.4'; end