Sha256: cdb3f0afa7a87f8ab2aaf42c6a9597968671633f4f74179f22ba5a5d2a610156

Contents?: true

Size: 555 Bytes

Versions: 1

Compression:

Stored size: 555 Bytes

Contents

# frozen_string_literal: true

require 'rbconfig'

class MyPDFKit
  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

1 entries across 1 versions & 1 rubygems

Version Path
my_pdfkit-0.1.0.0 lib/my_pdfkit/os.rb