Module: Mantra::Helpers::RegexpHelper

Included in:
Manifest::Element, Manifest::Scope, Transform::TemplatizeIpAddress, Transform::TemplatizeValue
Defined in:
lib/mantra/helpers/regexp_helper.rb

Instance Method Summary collapse

Instance Method Details

#to_regexp(string) ⇒ Object



5
6
7
8
# File 'lib/mantra/helpers/regexp_helper.rb', line 5

def to_regexp(string)
  escaped_string = Regexp.escape(string)
  Regexp.new("^#{escaped_string.gsub("\\*", ".+")}$")
end