module Vagrant::Util::ShellQuote

Public Class Methods

escape(text, quote) click to toggle source

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

@param [String] text Text to escape @param [String] quote The quote character, such as “

# File lib/vagrant/util/shell_quote.rb, line 8
def self.escape(text, quote)
  text.gsub(/#{quote}/) do |m|
    "#{m}\\#{m}#{m}"
  end
end