Simplify pattern lexeme fabrication and matcher
This commit is contained in:
parent
af9b0bfbae
commit
afa2451421
|
@ -6,7 +6,7 @@ module Gitlab
|
||||||
require_dependency 're2'
|
require_dependency 're2'
|
||||||
|
|
||||||
class Pattern < Lexeme::Value
|
class Pattern < Lexeme::Value
|
||||||
PATTERN = %r{^(?<regexp>/.+/[ismU]*)$}.freeze
|
PATTERN = %r{^/.+/[ismU]*$}.freeze
|
||||||
|
|
||||||
def initialize(regexp)
|
def initialize(regexp)
|
||||||
@value = regexp
|
@value = regexp
|
||||||
|
@ -23,7 +23,7 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.build(string)
|
def self.build(string)
|
||||||
new(string.match(PATTERN)[:regexp])
|
new(string)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue