Skip to content

Commit 4cf5020

Browse files
committed
Fix compatibility with --enable-frozen-string-literal
This option has been available since a long time, but many gems don't support it, I'm trying to fix that. Also it's not unlikely that this will become the default a few years down the line: https://bugs.ruby-lang.org/issues/20205
1 parent 10141c4 commit 4cf5020

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ jobs:
1414
- '3.0'
1515
- '3.1'
1616
- '3.2'
17+
- '3.3'
18+
rubyopt: [""]
19+
include:
20+
- ruby-version: '3.3'
21+
rubyopt: "--enable-frozen-string-literal --debug-frozen-string-literal"
1722

1823
steps:
19-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2025
- uses: ruby/setup-ruby@v1
2126
with:
2227
ruby-version: "${{ matrix.ruby-version }}"
2328
bundler-cache: true
24-
- run: bundle exec rake
29+
- run: bundle exec rake RUBYOPT="${{ matrix.rubyopt }}"

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
rails-i18n (7.0.8)
4+
rails-i18n (7.0.9)
55
i18n (>= 0.7, < 2)
66
railties (>= 6.0.0, < 8)
77

rails/transliteration/ru.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def rule
1313

1414
chars = string.scan(%r{#{multi_keys.join '|'}|\w|.})
1515

16-
result = ""
16+
result = +""
1717

1818
chars.each_with_index do |char, index|
1919
if upper.has_key?(char) && lower.has_key?(chars[index+1])

spec/support/ruby_content.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RailsI18n
44
module Spec
55
module RubyContent
66
def content
7-
@content ||= eval(IO.read(@filepath), TOPLEVEL_BINDING)
7+
@content ||= eval(File.read(@filepath), TOPLEVEL_BINDING, @filepath)
88
end
99
end
1010
end

0 commit comments

Comments
 (0)