Class: Bosh::Common::Version::ReleaseVersion
- Inherits:
-
SemiSemanticVersion
- Object
- SemiSemanticVersion
- Bosh::Common::Version::ReleaseVersion
- Defined in:
- lib/common/version/release_version.rb
Constant Summary collapse
- DEFAULT_POST_RELEASE_SEGMENT =
SemiSemantic::VersionSegment.parse('dev.1')
Instance Attribute Summary
Attributes inherited from SemiSemanticVersion
Class Method Summary collapse
Instance 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
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/common/version/release_version.rb', line 9 def self.parse(version) raise ArgumentError, 'Invalid Version: nil' if version.nil? version = version.to_s #convert old-style dev version suffix to new dev post-release segment matches = /\A(?<release>.*)(\.(?<dev>[0-9]+)-dev)\z/.match(version) unless matches.nil? version = matches[:release] + "+dev." + matches[:dev] end self.new(SemiSemantic::Version.parse(version)) end |
Instance Method Details
#to_old_format ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/common/version/release_version.rb', line 22 def to_old_format matches = /\A(?<release>.*)(\+dev\.(?<dev>[0-9]+))\z/.match(to_s) if matches.nil? return nil end matches[:release] + '.' + matches[:dev] + "-dev" end |