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

.fromString(version_string) ⇒ Bump::VersionNumber

Creates the version number object from the string

Parameters:

  • version_string (String)

Returns:



15
16
17
18
19
# File 'lib/bump/domain/version_number_factory.rb', line 15

def self.fromString version_string
    match = VERSION_REGEXP.match version_string

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