Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with --enable-frozen-string-literal #2033

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix compatibility with --enable-frozen-string-literal
Ever since Ruby 2.3 it has been possible to enable frozen string
literals globally via `RUBYOPT`, and it is scheduled to be the default
in Ruby 4.
  • Loading branch information
byroot committed Jul 11, 2024
commit f06e2d047d218156989a0b3747be2b2b0650a285
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
rack_session: ${{ matrix.rack_session }}
puma: ${{ matrix.puma }}
tilt: ${{ matrix.tilt }}
RUBYOPT: "--enable-frozen-string-literal --debug-frozen-string-literal"

steps:
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ gem 'rdiscount', platforms: [:ruby]
gem 'rdoc'
gem 'redcarpet', platforms: [:ruby]
gem 'simplecov', require: false
gem 'slim', '~> 4'
gem 'slim', '~> 5'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I had to upgrade otherwise it was blocking upgrading tilt to 2.2.0 which is needed for this.

gem 'yajl-ruby', platforms: [:ruby]
gem 'zeitwerk'

Expand Down
2 changes: 1 addition & 1 deletion sinatra-contrib/lib/sinatra/capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def capture(*args, &block)
with_haml_buffer(buffer) { capture_haml(*args, &block) }
else
buf_was = @_out_buf
@_out_buf = ''
@_out_buf = +''
begin
raw = block[*args]
captured = block.binding.eval('@_out_buf')
Expand Down
2 changes: 2 additions & 0 deletions sinatra-contrib/lib/sinatra/link_header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def link(*urls)
http_pattern = ['<%s>', *options].join ';'
link = (response['Link'] ||= '')

link = response['Link'] = +link

urls.map do |url|
link << "," unless link.empty?
link << (http_pattern % url)
Expand Down
2 changes: 1 addition & 1 deletion sinatra-contrib/lib/sinatra/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_response(url)
end

def log
@log ||= ''
@log ||= +''
loop { @log << pipe.read_nonblock(1) }
rescue Exception
@log
Expand Down
2 changes: 1 addition & 1 deletion test/integration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def initialize(server, port, async)
def run
return unless installed?
kill
@log = ""
@log = +""
super
at_exit { kill }
end
Expand Down
2 changes: 1 addition & 1 deletion test/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def to_pattern(*)
end

def params(input)
{ "one" => "this", "two" => "is", "three" => "a", "four" => "test" }
{ "one" => +"this", "two" => +"is", "three" => +"a", "four" => +"test" }
end
end

Expand Down
Loading