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!)



166
167
168
169
170
171
172
173
# File 'lib/beaker-rspec/helpers/serverspec.rb', line 166

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