Simplify pattern lexeme fabrication and matcher

This commit is contained in:
Grzegorz Bizon 2018-05-18 10:14:19 +02:00
parent af9b0bfbae
commit afa2451421
1 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ module Gitlab
require_dependency 're2'
class Pattern < Lexeme::Value
PATTERN = %r{^(?<regexp>/.+/[ismU]*)$}.freeze
PATTERN = %r{^/.+/[ismU]*$}.freeze
def initialize(regexp)
@value = regexp
@ -23,7 +23,7 @@ module Gitlab
end
def self.build(string)
new(string.match(PATTERN)[:regexp])
new(string)
end
end
end