Commit afa24514 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Simplify pattern lexeme fabrication and matcher

parent af9b0bfb
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -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 ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment