Created
July 8, 2016 01:20
-
-
Save edgar/bfa225fe50099ca3737f86a96bc2b090 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v1 = '0.3.2' | |
v2 = '0.10.1' | |
a1 = v1.split('.').map{|v| v.to_i} | |
a2 = v2.split('.').map{|v| v.to_i} | |
(a1 <=> a2) < 0 # v1 < v2 | |
=> true | |
(a1 <=> a2) > 0 # v1 > v2 | |
=> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment