class Relix::Version

Attributes

major[R]
minor[R]
patch[R]

Public Class Methods

new(version) click to toggle source
# File lib/relix/version.rb, line 9
def initialize(version)
  @major, @minor, @patch = version.to_s.split(".").collect{|e| e.to_i}
  @minor ||= 0
  @patch ||= 0
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/relix/version.rb, line 15
def <=>(other)
  case other
  when String
    (self <=> Version.new(other))
  else
    if((r = (major <=> other.major)) != 0)
      r
    elsif((r = (minor <=> other.minor)) != 0)
      r
    else
      (patch <=> other.patch)
    end
  end
end