Class: Specinfra::Backend::PowerShell::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/beaker-rspec/helpers/serverspec.rb

Instance Method Summary collapse

Instance Method Details

#convert_regexp(target) ⇒ Object

Do a better job at escaping regexes, handle both LF and CRLF (YAY!)



155
156
157
158
159
160
161
162
# File 'lib/beaker-rspec/helpers/serverspec.rb', line 155

def convert_regexp(target)
  case target
  when Regexp
    target.source
  else
    Regexp.escape(target.to_s.gsub '/', '\/').gsub('\n', '(\r\n|\n)')
  end
end