Sha256: dd087c96082998e8a5131a2a5ad31950c92e240f10f79f073a3eca4d29368036
Contents?: true
Size: 759 Bytes
Versions: 1
Compression:
Stored size: 759 Bytes
Contents
# encoding: utf-8 module Adhearsion #:nodoc: VERSION = '2.0.0.rc1' class PkgVersion include Comparable attr_reader :major, :minor, :revision def initialize(version = nil) version ||= "" @major, @minor, @revision, @patchlevel = version.split(".", 4).map(&:to_i) @major = 0 unless @major end def <=>(other) return @major <=> other.major unless (@major <=> other.major) == 0 return @minor <=> other.minor unless (@minor <=> other.minor) == 0 return @revision <=> other.revision unless (@revision <=> other.revision) == 0 return 0 end def self.sort self.sort! { |a,b| a <=> b } end def to_s "#{@major}.#{@minor}.#{@revision}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-2.0.0.rc1 | lib/adhearsion/version.rb |