Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not call =~ on Integer #177

Merged
merged 1 commit into from Feb 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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