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 "



11
12
13
14
15
# File 'lib/vagrant/util/shell_quote.rb', line 11

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