summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-05-09 23:54:56 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-05-10 01:25:08 -0600
commitcbb341a5b1867793c811f707a3d0e488b780a554 (patch)
treec061f11b5947150c74545eb0cbd1efba89ef1b16
parent2979cda8c62fc4325a276dcc421d54de3a8c3535 (diff)
alias File.exists? to File.exist? when loading RGhost optimizer to patch incompatibility when using Ruby 3.2
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor/pdf/optimizer/rghost.rb3
2 files changed, 4 insertions, 0 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index e3427a95..4cda737d 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -50,6 +50,7 @@ Bug Fixes::
* don't crash if page background image value is empty (interpret as "none")
* prevent special character substitution from interfering with callouts in plain verbatim block (#2390)
* remove deprecated, undocumented `svg-font-family` theme key (the correct key is `svg-fallback-font-family`)
+* alias `File.exists?` to `File.exist?` when loading RGhost optimizer to patch incompatibility when using Ruby 3.2
== 2.3.7 (2023-04-16) - @mojavelinux
diff --git a/lib/asciidoctor/pdf/optimizer/rghost.rb b/lib/asciidoctor/pdf/optimizer/rghost.rb
index 0bb011ad..880cf940 100644
--- a/lib/asciidoctor/pdf/optimizer/rghost.rb
+++ b/lib/asciidoctor/pdf/optimizer/rghost.rb
@@ -7,6 +7,9 @@ require 'rghost/gs_alone'
require 'tmpdir'
autoload :Open3, 'open3'
+# rghost still uses File.exists?
+File.singleton_class.alias_method :exists?, :exist? unless File.respond_to? :exists?
+
RGhost::GSAlone.prepend (Module.new do
def initialize params, debug
(@params = params.drop 0).push(*(@params.pop.split File::PATH_SEPARATOR))