class Xezat::Cygversion
Public Class Methods
new(str)
click to toggle source
# File lib/xezat/cygversion.rb, line 7 def initialize(str) matched = str.match(/(.+)-(.+)/) version = matched[1] @release = matched[2] split = version.split('+') @version = split[0].tr('_', '.') @revision = split.length >= 2 ? split[1].match(/(\d+)/)[0].to_i : Time.at(0).strftime('%Y%m%d').to_i end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/xezat/cygversion.rb, line 26 def <=>(other) result = (to_v <=> other.to_v) return result unless result.nil? (to_a <=> other.to_a) end
to_a()
click to toggle source
# File lib/xezat/cygversion.rb, line 22 def to_a [@version, @revision, @release] end
to_v()
click to toggle source
# File lib/xezat/cygversion.rb, line 16 def to_v [Gem::Version.new(@version), @revision, @release] rescue ArgumentError to_a end