Sha256: f873c35832b38728169c450afa3a5e957d6661bd1b1f2f3da348d41e93898171

Contents?: true

Size: 522 Bytes

Versions: 7

Compression:

Stored size: 522 Bytes

Contents

require 'rbconfig'

class PDFKit
  module OS
    def self.host_is_windows?
      !(RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince/).nil?
    end

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pdfkit-0.8.5 lib/pdfkit/os.rb
pdfkit-0.8.4.3.2 lib/pdfkit/os.rb
pdfkit-0.8.4.3.1 lib/pdfkit/os.rb
pdfkit-0.8.4.2 lib/pdfkit/os.rb
pdfkit-0.8.4.1 lib/pdfkit/os.rb
pdfkit-0.8.4 lib/pdfkit/os.rb
pdfkit-0.8.3 lib/pdfkit/os.rb