Skip to content

Commit

Permalink
Do not call =~ on Integer (#177)
Browse files Browse the repository at this point in the history
Ruby 2.7 will emit the following deprecation warning if we call =~ on an Integer:
warning: deprecated Object#=~ is called on Integer; it always returns nil
  • Loading branch information
Tolsto committed Feb 9, 2020
1 parent 146beda commit 1a1f716
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mock_redis/zset_methods.rb
Expand Up @@ -26,7 +26,7 @@ def zadd(key, *args)
end

def zadd_one_member(key, score, member, zadd_options = {})
assert_scorey(score) unless score =~ /(\+|\-)inf/
assert_scorey(score) unless score.to_s =~ /(\+|\-)inf/

with_zset_at(key) do |zset|
if zadd_options[:incr]
Expand Down Expand Up @@ -326,7 +326,7 @@ def looks_like_float?(x)
end

def assert_scorey(value, message = 'ERR value is not a valid float')
return if value =~ /\(?(\-|\+)inf/
return if value.to_s =~ /\(?(\-|\+)inf/

value = $1 if value.to_s =~ /\((.*)/
unless looks_like_float?(value)
Expand Down

0 comments on commit 1a1f716

Please sign in to comment.