erubi 1.13.0 → 1.13.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +4 -0
  3. data/Rakefile +1 -1
  4. data/lib/erubi.rb +15 -6
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9364047dc0b7365bae5a6f9ee75c748a0ef02bf4e516331c2d0533da9fe49e04
4
- data.tar.gz: 9416aeee2c6c4556c3f19f7b918819cbe076493601efd9470815870fac1a2625
3
+ metadata.gz: 547aa741f72fd87ac7747c597614f457b3880d01d3b3aa161c24e62c93f00cc7
4
+ data.tar.gz: d465d4b57e9abe24de9cf5859773691dfee9198ca0c4d05a5ca8f0903b2acefd
5
5
  SHA512:
6
- metadata.gz: ecd851eb258b2a0302d6a46b747722100aad3a145c4c22b6d1d14f856f094507ebbc84e151a1b9cd9795bb59b0154866e38a08798c75e9726c45b4d987ec48e5
7
- data.tar.gz: 0c1f32494ca8a192de037c1497065e1f0901cf646fbb090972de215bf66f0fbf2e0774fa38309c50eab288d60dfe59a634e431395912275ec75a2aa3bf4c66be
6
+ metadata.gz: 109432844ed8df5daab8e5b6e6aa2404c314009f968129ec02c920f6c75094f4a484207751d34cb2255d6c3d5f286e14c369ba54dc398e06266d22e84e2f4e24
7
+ data.tar.gz: 5eab140a49714dd65c67b9eb7e196a86f25c9a3a59348b04dc3d7b57db8c0cbccbca28f94dae2ae69c04382e5ab6c4350c7f8dd99db2dbbd0121ba0759bd0ca1
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.13.1 (2024-12-19)
2
+
3
+ * Avoid spurious frozen string literal warnings for chilled strings when using Ruby 3.4 (jeremyevans)
4
+
1
5
  === 1.13.0 (2024-06-13)
2
6
 
3
7
  * Define Erubi.h as a module function (jeremyevans)
data/Rakefile CHANGED
@@ -42,7 +42,7 @@ end
42
42
 
43
43
  spec = proc do |env|
44
44
  env.each{|k,v| ENV[k] = v}
45
- sh "#{FileUtils::RUBY} #{'-w' if RUBY_VERSION >= '3'} test/test.rb"
45
+ sh "#{FileUtils::RUBY} #{'-w' if RUBY_VERSION >= '3'} #{'-W:strict_unused_block' if RUBY_VERSION >= '3.4'} test/test.rb"
46
46
  env.each{|k,v| ENV.delete(k)}
47
47
  end
48
48
 
data/lib/erubi.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Erubi
4
- VERSION = '1.13.0'
4
+ VERSION = '1.13.1'
5
5
 
6
6
  # :nocov:
7
7
  if RUBY_VERSION >= '1.9'
@@ -205,16 +205,25 @@ module Erubi
205
205
 
206
206
  private
207
207
 
208
+ if RUBY_VERSION >= '2.3'
209
+ def _dup_string_if_frozen(string)
210
+ +string
211
+ end
212
+ # :nocov:
213
+ else
214
+ def _dup_string_if_frozen(string)
215
+ string.frozen? ? string.dup : string
216
+ end
217
+ end
218
+ # :nocov:
219
+
208
220
  # Add raw text to the template. Modifies argument if argument is mutable as a memory optimization.
209
221
  # Must be called with a string, cannot be called with nil (Rails's subclass depends on it).
210
222
  def add_text(text)
211
223
  return if text.empty?
212
224
 
213
- if text.frozen?
214
- text = text.gsub(/['\\]/, '\\\\\&')
215
- else
216
- text.gsub!(/['\\]/, '\\\\\&')
217
- end
225
+ text = _dup_string_if_frozen(text)
226
+ text.gsub!(/['\\]/, '\\\\\&')
218
227
 
219
228
  with_buffer{@src << " << '" << text << @text_end}
220
229
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erubi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-06-13 00:00:00.000000000 Z
12
+ date: 2024-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.5.9
88
+ rubygems_version: 3.5.22
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Small ERB Implementation