lib/adhearsion/version.rb in adhearsion-1.0.3 vs lib/adhearsion/version.rb in adhearsion-1.1.0
- old
+ new
@@ -1,26 +1,29 @@
module Adhearsion #:nodoc:
module VERSION #:nodoc:
MAJOR = 1 unless defined? MAJOR
- MINOR = 0 unless defined? MINOR
- TINY = 3 unless defined? TINY
+ MINOR = 1 unless defined? MINOR
+ TINY = 0 unless defined? TINY
STRING = [MAJOR, MINOR, TINY].join('.') unless defined? STRING
end
class PkgVersion
include Comparable
attr_reader :major, :minor, :revision
def initialize(version="")
- @major, @minor, @revision = version.split(".").map(&:to_i)
+ version = "" if version.nil?
+ @major, @minor, @revision, @patchlevel = version.split(".", 4).map(&:to_i)
+ @major = 0 unless @major
end
def <=>(other)
return @major <=> other.major if ((@major <=> other.major) != 0)
return @minor <=> other.minor if ((@minor <=> other.minor) != 0)
return @revision <=> other.revision if ((@revision <=> other.revision) != 0)
+ return 0
end
def self.sort
self.sort!{|a,b| a <=> b}
end