Sha256: 4cddf796c324a74586ab1d12c9f3084d97ef2735b3dc581ac2680dfb283f65ab
Contents?: true
Size: 982 Bytes
Versions: 1
Compression:
Stored size: 982 Bytes
Contents
module Adhearsion #:nodoc: module VERSION #:nodoc: MAJOR = 1 unless defined? MAJOR MINOR = 0 unless defined? MINOR TINY = 2 unless defined? TINY NANO = 1 unless defined? NANO STRING = [MAJOR, MINOR, TINY, NANO].join('.') unless defined? STRING end class PkgVersion include Comparable attr_reader :major, :minor, :revision, :build def initialize(version="") @major, @minor, @revision, @build = version.split(".").map(&:to_i) 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 @build <=> other.build if ((@build <=> other.build) != 0) end def self.sort self.sort!{|a,b| a <=> b} end def to_s @major.to_s + "." + @minor.to_s + "." + @revision.to_s + "." + @build.to_s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-cw-1.0.2.1 | lib/adhearsion/version.rb |