# File lib/monkey/version.rb, line 19 def <=>(other) return super unless other.respond_to? :to_version mine, others = fields.dup, other.to_version.fields loop do a, b = mine.unshift, others.unshift return 0 if a.nil? and b.nil? return 1 if b.nil? or (a.is_a? Integer and b.is_a? String) return -1 if a.nil? or (b.is_a? Integer and a.is_a? String) return comp unless (comp = (a <=> b)) == 0 end end