module PDFKit::OS

Public Class Methods

host_is_windows?() click to toggle source
# File lib/pdfkit/os.rb, line 7
def self.host_is_windows?
  !(RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince/).nil?
end
shell_escape_for_os(args) click to toggle source
# File lib/pdfkit/os.rb, line 11
def self.shell_escape_for_os(args)
  if (host_is_windows?)
    # Windows reserved shell characters are: & | ( ) < > ^
    # See http://technet.microsoft.com/en-us/library/cc723564.aspx#XSLTsection123121120120
    args.map { |arg| arg.gsub(/([&|()<>^])/,'^\1') }.join(" ")
  else
    args.shelljoin
  end
end