Sha256: 00f2ec754264935787b3c4028166a718e4be8454a6893d642498241979f89d88

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

class Version
  include Comparable
  attr_accessor :major, :minor, :patch

  def initialize(version_string)
    array = version_string.split(".")
    self.major = array[0].to_i
    self.minor = array[1].to_i
    self.patch = array[2].to_i
  end

  def ==(other)
    other.class == self.class && other.major == self.major && other.minor == self.minor && other.patch == self.patch
  end

  def <=>(other)
    return nil if self.class != other.class
    [self.major, self.minor, self.patch] <=> [other.major, other.minor, other.patch]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
build_promotion_tool-0.1.3 lib/build_promotion_tool/comparator/version.rb
build_promotion_tool-0.1.2 lib/build_promotion_tool/comparator/version.rb
build_promotion_tool-0.1.1 lib/build_promotion_tool/comparator/version.rb