Actions
Feature #41976
openRuby 3.4 support
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Description
Ruby 3.4.0 will be released on December 25, 2024.
Files
Related issues
Updated by Go MAEDA 7 days ago
- Copied from Feature #39761: Ruby 3.3 support added
Updated by Go MAEDA 6 days ago
- File 0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch 0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch added
The attached patch fixes "literal string will be frozen in the future" warnings on Ruby 3.4.0 rc1.
/path/to/redmine/app/views/gantts/show.html.erb:342: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
/path/to/redmine/app/views/repositories/_breadcrumbs.html.erb:18: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
/path/to/redmine/lib/redmine/i18n.rb:154: warning: warning: string returned by :ar.to_s will be frozen in the future
Updated by Katsuya HIDAKA 4 days ago
+1
0001-Fix-Avoid-literal-string-will-be-frozen-in-the-futur.patch
- clss << " nwday" if @gantt.non_working_week_days.include?(wday)
+ clss += " nwday" if @gantt.non_working_week_days.include?(wday)
How about modifying it like this?
clss = "gantt_hdr"
clss << " nwday" if @gantt.non_working_week_days.include?(wday)
%>
- <%= content_tag(:div, :style => style, :class => clss) do %>
+ <%= content_tag(:div, :style => style, :class => ["gantt_hdr", { nwday: @gantt.non_working_week_days.include?(wday) }]) do %>
<%= day_num.day %>
<% end %>
<%
With this change, the class attribute would produce the following results:
redmine-app(dev)> helper.content_tag(:div, "", :class => ["gantt_hdr", { nwday: false }]) => "<div class=\"gantt_hdr\"></div>" redmine-app(dev)> helper.content_tag(:div, "", :class => ["gantt_hdr", { nwday: true }]) => "<div class=\"gantt_hdr nwday\"></div>"
Alternatively, this approach would also work:
- clss = "gantt_hdr"
+ clss = +"gantt_hdr"
clss << " nwday" if @gantt.non_working_week_days.include?(wday)
Reasons:
- The current implementation in the patch always creates a new string instance.
- Other similar parts of the code use String#+@, so this would improve consistency.
Personally, I think the former approach is preferable, but the latter also seems like a valid option.
Actions