Skip to content

Commit

Permalink
use numerics
Browse files Browse the repository at this point in the history
  • Loading branch information
mtichner committed Nov 14, 2022
1 parent 0d308f0 commit a78135f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/jmespath/nodes/condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def optimize
class ComparatorCondition < Node
COMPARATOR_TO_CONDITION = {}
COMPARABLE_TYPES = [Integer, Float, String].freeze
NUMERIC_TYPES = [Integer, Float].freeze
def initialize(left, right, child)
@left = left
@right = right
Expand All @@ -45,7 +44,7 @@ def visit(_value)
def comparable?(left_value, right_value)
if COMPARABLE_TYPES.include?(left_value.class) && COMPARABLE_TYPES.include?(right_value.class)
return true if left_value.class == right_value.class
return true if NUMERIC_TYPES.include?(left_value.class) && NUMERIC_TYPES.include?(right_value.class)
return true if left_value.is_a?(Numeric) && right_value.is_a?(Numeric)
end
end
end
Expand Down

0 comments on commit a78135f

Please sign in to comment.