ruby3-backward-compatibility 1.5.1 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6fec0a3e4879630bfd734dbd22eff886aa0a606f5781e63da6cd088bf2db848
4
- data.tar.gz: d8110a7a50554ec430a803b4a83a911f11fa78d174e96ab17de83e8ca64c37e0
3
+ metadata.gz: 99e016f667fe875a4ee28e52d02fbacc029bbf1b4cd90f2779643057a80489c4
4
+ data.tar.gz: 6a8817e47418e7790613d8feeae7f57b8f371c3fc4264931f79b23ca98c8eafb
5
5
  SHA512:
6
- metadata.gz: c4e6d46bb866d338089db8be6f49cd4f398f8ffdb33d18bf0e70670afa6cbbf5b003f1d408dc2b0f367ea3f38405c35ece6e79e7340d0be56f9589204383e8c9
7
- data.tar.gz: 9e6e30545c9869dc10e1128c02b11ec6b3506d7ef1b3c0229b135719a54020bd1a6039a73c72cddbd6301fb30c1b903dcb5239af975c826bd0214295566ccc32
6
+ metadata.gz: 8c24e4cb277bd6ecaca7531b49adfd139fd7ec9af8b96208b1458b1501bf12cd3acc45cf7b9ae4b90ff23d55f619ab5ab2973a0833d0ea860aeb2549d61f5e4b
7
+ data.tar.gz: 13e9d000313664cf9aee7cfef4a903b31fe834909c46b63c789d7282d3afc7487d07d55e4f4ca0f3fca036f9b4695617bfd9d04953204234c809d5da52ed9f55
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.6.0] - 2026-08-21
4
+
5
+ - `ERB#src` gives back a mutable string again. Newer erb 6 releases freeze the
6
+ compiled source, which breaks callers that modify it in place, for example tilt 1.x
7
+ force_encodings it.
8
+
3
9
  ## [1.5.1] - 2026-01-13
4
10
 
5
11
  - Ruby 4: Gem will no longer refuse to load.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby3-backward-compatibility (1.5.1)
4
+ ruby3-backward-compatibility (1.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -105,7 +105,12 @@ but this was changed to
105
105
  ERB.new(string, safe_level: nil, trim_mode: nil, eoutvar: '_erbout')
106
106
  ```
107
107
 
108
- To allow both styles, use
108
+
109
+ Additionally, ERB#src used to return a mutable string, which
110
+ some consumer might rely on. New ERB versions return frozen strings.
111
+
112
+
113
+ To fix both these issues,
109
114
 
110
115
  ```
111
116
  require 'ruby3_backward_compatibility/compatibility/erb'
@@ -11,6 +11,26 @@ module Ruby3BackwardCompatibility
11
11
  end
12
12
  super(str, trim_mode: trim_mode, eoutvar: eoutvar)
13
13
  end
14
+
15
+ # Newer erb 6 releases freeze the compiled source that #src returns. Every
16
+ # earlier erb handed back a mutable string, and callers written against those
17
+ # are free to modify it in place, e.g. tilt 1.x.
18
+ def src
19
+ original = super
20
+ return original unless original.frozen?
21
+
22
+ # A frozen ERB cannot hold the memo, and raising FrozenError here would be
23
+ # a regression: erb itself is happy to return #src from a frozen template,
24
+ # and Ractor.make_shareable deep-freezes, so anything sharing a compiled
25
+ # template across Ractors would break.
26
+ return original.dup if frozen?
27
+
28
+ unless @_ruby3_backward_compatibility_src_of.equal?(original)
29
+ @_ruby3_backward_compatibility_src_of = original
30
+ @_ruby3_backward_compatibility_src = original.dup
31
+ end
32
+ @_ruby3_backward_compatibility_src
33
+ end
14
34
  end
15
35
  end
16
36
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ruby3BackwardCompatibility
4
- VERSION = '1.5.1'
4
+ VERSION = '1.6.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby3-backward-compatibility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-01-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: byebug
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - ">="
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
- description:
28
26
  email:
29
27
  - tobias.kraze@makandra.de
30
28
  executables: []
@@ -65,7 +63,6 @@ metadata:
65
63
  homepage_uri: https://github.com/makandra/ruby3-backward-compatibility
66
64
  source_code_uri: https://github.com/makandra/ruby3-backward-compatibility
67
65
  changelog_uri: https://github.com/makandra/ruby3-backward-compatibility/blob/main/CHANGELOG.md
68
- post_install_message:
69
66
  rdoc_options: []
70
67
  require_paths:
71
68
  - lib
@@ -80,8 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
77
  - !ruby/object:Gem::Version
81
78
  version: '0'
82
79
  requirements: []
83
- rubygems_version: 3.1.6
84
- signing_key:
80
+ rubygems_version: 3.6.9
85
81
  specification_version: 4
86
82
  summary: Backward compatibility for Ruby 3 stdlib
87
83
  test_files: []