class Semver::Parser
@api private
Constants
- PATTERN
Public Instance Methods
parse(string)
click to toggle source
# File lib/semver/parser.rb, line 18 def parse(string) matches = PATTERN.match(string.to_s) raise InvalidFormatError, string unless matches { major: matches[1].to_i, minor: matches[2].to_i, patch: matches[3].to_i, pre_release: left_chop(matches[4]), build_metadata: left_chop(matches[8]), } end
Private Instance Methods
left_chop(value)
click to toggle source
# File lib/semver/parser.rb, line 32 def left_chop(value) value ? value[1..-1] : nil end