Module: PEBuild::Util::VersionString Private

Defined in:
lib/pe_build/util/version_string.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.10.2

Class Method Summary collapse

Class Method Details

.compare(a, b) ⇒ Integer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Approximate comparison of two version strings using <=>

Uses the Gem::Version class. Any nightly build tags, such as -rc4-165-g9a98c9f, will be stripped from the version.

Parameters:

  • a (String)

    The first version string.

  • b (String)

    The second version string.

Returns:

  • (Integer)

    A -1, 0 or 1.

Since:

  • 0.10.2



19
20
21
# File 'lib/pe_build/util/version_string.rb', line 19

def self.compare(a, b)
  Gem::Version.new(a.split('-').first) <=> Gem::Version.new(b.split('-').first)
end