This logic seems a bit convoluted....what about this instead?

``` ruby
parts = redis_version.split('.')
parts.pop if parts.last.include?('-')
version_without_prerelease_string = parts.join('.')
return if Gem::Version.new(version_without_prelease_string) >= Gem::Version.new(version)
```