I've got a mobile app that makes an api call. In the api call, I'm sending the version number of the app because the returned json could be a bit different depending on the api version.
So when I have app version 2.4.1
and I need to check against the current api version 2.4.4
, I everything is fine because I'm using
if user_version.gsub('.','').to_i < server_version.gsub('.','').to_i //the user version is not current, ask them to update end
the problem comes in down the line when somebody releases version 2.5. With the above code, the user would have 2.4.4
which gets translated to 244
which is larger than the server side 2.5
or 25
.
How would you check this to cover these instances?