Sha256: 45c820bd7f1e085d763c142ba53885f9dfb85f11e34b73db3f207d68eebecac2
Contents?: true
Size: 761 Bytes
Versions: 29
Compression:
Stored size: 761 Bytes
Contents
class Version include Comparable attr_reader :major, :feature_group, :feature, :bugfix def initialize(version="") v = version.split(".") @major = v[0].to_i @feature_group = v[1] ? v[1].to_i : 0 @feature = v[2] ? v[2].to_i : 0 @bugfix = v[2] ? v[3].to_i : 0 end def <=>(other) return @major <=> other.major if ((@major <=> other.major) != 0) return @feature_group <=> other.feature_group if ((@feature_group <=> other.feature_group) != 0) return @feature <=> other.feature if ((@feature <=> other.feature) != 0) return @bugfix <=> other.bugfix end def self.sort self.sort!{|a,b| a <=> b} end def to_s @major.to_s + "." + @feature_group.to_s + "." + @feature.to_s + "." + @bugfix.to_s end end
Version data entries
29 entries across 29 versions & 1 rubygems