Class: Bosh::Common::Version::BoshVersion

Inherits:
SemiSemanticVersion show all
Defined in:
lib/common/version/bosh_version.rb

Constant Summary

Constants inherited from SemiSemanticVersion

SemiSemanticVersion::DEFAULT_POST_RELEASE_SEGMENT

Instance Attribute Summary

Attributes inherited from SemiSemanticVersion

#version

Class Method Summary collapse

Methods inherited from SemiSemanticVersion

#<=>, #default_post_release, #increment_post_release, #increment_release, #initialize, parse_and_compare, #timestamp_release, #to_s

Constructor Details

This class inherits a constructor from Bosh::Common::Version::SemiSemanticVersion

Class Method Details

.parse(version) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
# File 'lib/common/version/bosh_version.rb', line 7

def self.parse(version)
  raise ArgumentError, 'Invalid Version: nil' if version.nil?
  version = version.to_s

  #discard anything after a space, including the space, to support compound bosh versions
  version = version.split(' ', 2)[0] if version =~ / /

  self.new(SemiSemantic::Version.parse(version))
end