module WindowsShellwords

Windows implementation

Public Class Methods

shellescape(str) click to toggle source
# File fastlane_core/lib/fastlane_core/core_ext/shellwords.rb, line 44
def shellescape(str)
  str = str.to_s

  # An empty argument will be skipped, so return empty quotes.
  # https://github.com/ruby/ruby/blob/a6413848153e6c37f6b0fea64e3e871460732e34/lib/shellwords.rb#L142-L143
  return '""'.dup if str.empty?

  str = str.dup

  # wrap in double quotes if contains space
  if str =~ /\s/
    # double quotes have to be doubled if will be quoted
    str.gsub!('"', '""')
    return '"' + str + '"'
  else
    return str
  end
end

Private Instance Methods

shellescape(str) click to toggle source
# File fastlane_core/lib/fastlane_core/core_ext/shellwords.rb, line 44
def shellescape(str)
  str = str.to_s

  # An empty argument will be skipped, so return empty quotes.
  # https://github.com/ruby/ruby/blob/a6413848153e6c37f6b0fea64e3e871460732e34/lib/shellwords.rb#L142-L143
  return '""'.dup if str.empty?

  str = str.dup

  # wrap in double quotes if contains space
  if str =~ /\s/
    # double quotes have to be doubled if will be quoted
    str.gsub!('"', '""')
    return '"' + str + '"'
  else
    return str
  end
end