From ac55a55d5c96ea6f80a95b7f380a0a820714d7f2 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 11 Oct 2024 22:29:35 +0200 Subject: [PATCH] Add frozen_string_literal magic header --- lib/wicked_pdf.rb | 2 ++ lib/wicked_pdf/binary.rb | 4 +++- lib/wicked_pdf/middleware.rb | 2 ++ lib/wicked_pdf/option_parser.rb | 2 ++ lib/wicked_pdf/pdf_helper.rb | 2 ++ lib/wicked_pdf/progress.rb | 2 ++ lib/wicked_pdf/railtie.rb | 2 ++ lib/wicked_pdf/tempfile.rb | 4 +++- lib/wicked_pdf/version.rb | 4 +++- lib/wicked_pdf/wicked_pdf_helper.rb | 2 ++ lib/wicked_pdf/wicked_pdf_helper/assets.rb | 2 ++ 11 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/wicked_pdf.rb b/lib/wicked_pdf.rb index dc05576f..f0d26eab 100644 --- a/lib/wicked_pdf.rb +++ b/lib/wicked_pdf.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # wkhtml2pdf Ruby interface # http://wkhtmltopdf.org/ diff --git a/lib/wicked_pdf/binary.rb b/lib/wicked_pdf/binary.rb index 383f9ea1..c7c7f348 100644 --- a/lib/wicked_pdf/binary.rb +++ b/lib/wicked_pdf/binary.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + class WickedPdf class Binary - EXE_NAME = 'wkhtmltopdf'.freeze + EXE_NAME = 'wkhtmltopdf' attr_reader :path, :default_version diff --git a/lib/wicked_pdf/middleware.rb b/lib/wicked_pdf/middleware.rb index 0761455c..73322b56 100644 --- a/lib/wicked_pdf/middleware.rb +++ b/lib/wicked_pdf/middleware.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WickedPdf class Middleware def initialize(app, options = {}, conditions = {}) diff --git a/lib/wicked_pdf/option_parser.rb b/lib/wicked_pdf/option_parser.rb index 3b5fb583..d6c86855 100644 --- a/lib/wicked_pdf/option_parser.rb +++ b/lib/wicked_pdf/option_parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WickedPdf class OptionParser BINARY_VERSION_WITHOUT_DASHES = Gem::Version.new('0.12.0') diff --git a/lib/wicked_pdf/pdf_helper.rb b/lib/wicked_pdf/pdf_helper.rb index bc0ac7c5..94297624 100644 --- a/lib/wicked_pdf/pdf_helper.rb +++ b/lib/wicked_pdf/pdf_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WickedPdf module PdfHelper def self.prepended(base) diff --git a/lib/wicked_pdf/progress.rb b/lib/wicked_pdf/progress.rb index 0b517072..7b9bab1e 100644 --- a/lib/wicked_pdf/progress.rb +++ b/lib/wicked_pdf/progress.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WickedPdf module Progress require 'pty' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw/ && RUBY_ENGINE != 'truffleruby' # no support for windows and truffleruby diff --git a/lib/wicked_pdf/railtie.rb b/lib/wicked_pdf/railtie.rb index 1e9d0a36..4f7fde0a 100644 --- a/lib/wicked_pdf/railtie.rb +++ b/lib/wicked_pdf/railtie.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'wicked_pdf/pdf_helper' require 'wicked_pdf/wicked_pdf_helper' require 'wicked_pdf/wicked_pdf_helper/assets' diff --git a/lib/wicked_pdf/tempfile.rb b/lib/wicked_pdf/tempfile.rb index b8079c0a..b2677f07 100644 --- a/lib/wicked_pdf/tempfile.rb +++ b/lib/wicked_pdf/tempfile.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'tempfile' require 'stringio' @@ -23,7 +25,7 @@ def write_in_chunks(input_string) def read_in_chunks rewind binmode - output_string = '' + output_string = +'' output_string << read(chunk_size) until eof? output_string rescue Errno::EINVAL => e diff --git a/lib/wicked_pdf/version.rb b/lib/wicked_pdf/version.rb index 7fd1ad82..0d338481 100644 --- a/lib/wicked_pdf/version.rb +++ b/lib/wicked_pdf/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WickedPdf - VERSION = '2.8.1'.freeze + VERSION = '2.8.1' end diff --git a/lib/wicked_pdf/wicked_pdf_helper.rb b/lib/wicked_pdf/wicked_pdf_helper.rb index dea4f1d3..3ce0ace9 100644 --- a/lib/wicked_pdf/wicked_pdf_helper.rb +++ b/lib/wicked_pdf/wicked_pdf_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class WickedPdf module WickedPdfHelper def self.root_path diff --git a/lib/wicked_pdf/wicked_pdf_helper/assets.rb b/lib/wicked_pdf/wicked_pdf_helper/assets.rb index 686d2d0c..dffde1dc 100644 --- a/lib/wicked_pdf/wicked_pdf_helper/assets.rb +++ b/lib/wicked_pdf/wicked_pdf_helper/assets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'net/http' require 'delegate' require 'stringio'