Class: Bump::VersionNumberFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/bump/domain/version_number_factory.rb

Overview

The factory class for the version number

Constant Summary collapse

VERSION_REGEXP =

Regexp for version expression

/^(\d+).(\d+).(\d+)(-(\S*))?$/

Class Method Summary collapse

Class Method Details

.from_string(version_string) ⇒ Bump::VersionNumber

Creates the version number object from the string

Parameters:

  • version_string (String)

Returns:



11
12
13
14
15
# File 'lib/bump/domain/version_number_factory.rb', line 11

def self.from_string(version_string)
  match = VERSION_REGEXP.match version_string

  VersionNumber.new match[1].to_i, match[2].to_i, match[3].to_i, match[5]
end