Skip to content

Commit

Permalink
Merge pull request #91 from chaadow/patch-1
Browse files Browse the repository at this point in the history
Fix frozen string literal issue for ruby 3.4.0
  • Loading branch information
jkraemer authored Nov 11, 2024
2 parents 5094ae6 + 75c9291 commit 09e0a87
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
ruby-version: ['3.1', '3.0', '2.7']
ruby-version: ['3.3', '3.1', '2.7']

steps:
- uses: actions/checkout@v3
Expand All @@ -26,5 +26,4 @@ jobs:
- name: Install PDFTK-Java
run: sudo apt install -y pdftk-java
- name: Run tests
run: bundle exec rake

run: RUBYOPT='--enable-frozen-string-literal --debug-frozen-string-literal' bundle exec rake
2 changes: 1 addition & 1 deletion lib/pdf_forms/data_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(data = {}, options = {})

# generate PDF content in this data format
def to_pdf_data
pdf_data = header
pdf_data = +header

@data.each do |key, value|
if Hash === value
Expand Down
4 changes: 2 additions & 2 deletions lib/pdf_forms/fdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def encode_data(fdf)

# pp 559 https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/pdf_reference_archives/PDFReference.pdf
def header
header = "%FDF-1.2\n\n1 0 obj\n<<\n/FDF << /Fields 2 0 R"
header = +"%FDF-1.2\n\n1 0 obj\n<<\n/FDF << /Fields 2 0 R"

# /F
header << "/F (#{options[:file]})" if options[:file]
Expand All @@ -45,7 +45,7 @@ def header

# pp 561 https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/pdf_reference_archives/PDFReference.pdf
def field(key, value)
field = "<<"
field = +"<<"
field << "/T" + "(#{key})"
field << "/V" + (Array === value ? "[#{value.map{ |v|"(#{quote(v)})" }.join}]" : "(#{quote(value)})")
field << ">>\n"
Expand Down
2 changes: 1 addition & 1 deletion lib/pdf_forms/pdftk_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def call_pdftk(*args)
def cat(*args)
in_files = []
page_ranges = []
file_handle = "A"
file_handle = +"A"
output = normalize_path args.pop

args.flatten.compact.each do |in_file|
Expand Down

0 comments on commit 09e0a87

Please sign in to comment.