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



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

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