Skip to content

Instantly share code, notes, and snippets.

@spedepekka
Created January 15, 2015 07:57
Show Gist options
  • Save spedepekka/4bce774f34d8448d4cf2 to your computer and use it in GitHub Desktop.
Save spedepekka/4bce774f34d8448d4cf2 to your computer and use it in GitHub Desktop.
run_loop 1.2.1 version compare problem
============ Test ===============
require 'run_loop'
def compare(a, b)
a = RunLoop::Version.new(a)
b = RunLoop::Version.new(b)
if a < b
puts "#{a} < #{b}"
elsif a > b
puts "#{a} > #{b}"
else
puts "#{a} == #{b}"
end
end
compare("0.12.0", "0.12.0.pre1")
compare("0.12.0", "0.12.0.pre")
compare("0.1", "0.2")
compare("0.1.1", "0.2")
compare("0.2", "0.21")
compare("0.2", "0.2.1")
compare("0.2.1", "0.2.1")
compare("0.2.1.a", "0.2.1")
compare("0.2.1.a", "0.2.1.b")
compare("0.2.1.c1", "0.2.1.c2")
============ Output ===============
0.12.0 < 0.12.0.pre1
0.12.0 < 0.12.0.pre
0.1 < 0.2
0.1.1 < 0.2
0.2 < 0.21
0.2 < 0.2.1
0.2.1 == 0.2.1
0.2.1.a > 0.2.1
0.2.1.a == 0.2.1.b
0.2.1.c1 < 0.2.1.c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment