Module: Vagrant::Util::ShellQuote

Defined in:
lib/vagrant/util/shell_quote.rb

Class Method Summary collapse

Class Method Details

.escape(text, quote) ⇒ Object

This will auto-escape the text with the given quote mark type.

Parameters:

  • text (String)

    Text to escape

  • quote (String)

    The quote character, such as "


8
9
10
11
12
# File 'lib/vagrant/util/shell_quote.rb', line 8

def self.escape(text, quote)
  text.gsub(/#{quote}/) do |m|
    "#{m}\\#{m}#{m}"
  end
end