File: 0002-Fix-Ruby-3-compatibility.patch

package info (click to toggle)
ruby-dbf 3.0.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,744 kB
  • sloc: ruby: 1,649; makefile: 9
file content (46 lines) | stat: -rw-r--r-- 1,517 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From: Keith Morrison <keithm@infused.org>
Date: Mon, 6 Apr 2020 14:20:01 -0700
Subject: [PATCH] use 2.7.1 for dev

Reviewed-By: Daniel Leidert <dleidert@debian.org>
Bug-Debian: https://bugs.debian.org/996215
Origin: https://github.com/infused/dbf/commit/c05fdddd4dc88f066040d903f7db8d6b3c576997.patch
Forwarded: not-needed
---
 lib/dbf/column_type.rb | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/dbf/column_type.rb b/lib/dbf/column_type.rb
index fd7e10d..b2b1f66 100644
--- a/lib/dbf/column_type.rb
+++ b/lib/dbf/column_type.rb
@@ -1,11 +1,6 @@
 module DBF
   module ColumnType
     class Base
-      ENCODING_ARGS = [
-        Encoding.default_external,
-        {undef: :replace, invalid: :replace}
-      ]
-
       attr_reader :decimal, :encoding
 
       def initialize(decimal, encoding)
@@ -79,7 +74,7 @@ module DBF
     class Memo < Base
       def type_cast(value)
         if encoding && !value.nil?
-          value.force_encoding(@encoding).encode(*ENCODING_ARGS)
+          value.force_encoding(@encoding).encode(Encoding.default_external, undef: :replace, invalid: :replace)
         else
           value
         end
@@ -95,7 +90,7 @@ module DBF
     class String < Base
       def type_cast(value)
         value = value.strip
-        @encoding ? value.force_encoding(@encoding).encode(*ENCODING_ARGS) : value
+        @encoding ? value.force_encoding(@encoding).encode(Encoding.default_external, undef: :replace, invalid: :replace) : value
       end
     end