Skip to content

Commit

Permalink
AP-5659: Freeze string literals and use unary + for mutable strings
Browse files Browse the repository at this point in the history
Handle deprecation notices wanring of ruby 4.0 intention to default
string literals to be frozen/immutable.

```shell
/Users/joel.sugarman/github/ministryofjustice/laa-apply-for-legal-aid/app/helpers/hash_format_helper.rb:23:
  warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
```
  • Loading branch information
jsugarman committed Jan 7, 2025
1 parent fd48b9e commit 47e135e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/helpers/hash_format_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module HashFormatHelper
# These methods add classes to the HTML structure
def format_hash(hash, html = "")
Expand All @@ -19,7 +21,7 @@ def format_hash(hash, html = "")

def build_dl_array(key, value)
content_tag(:dl, class: "govuk-body kvp govuk-!-margin-bottom-0") do
dl_contents = ""
dl_contents = +""
dl_contents << content_tag(:dt, standardize_key(key))
value.each do |val|
dl_contents << if val.is_a?(Hash)
Expand All @@ -34,7 +36,7 @@ def build_dl_array(key, value)

def build_dl(key, value)
content_tag(:dl, class: "govuk-body kvp govuk-!-margin-bottom-0") do
dl_contents = ""
dl_contents = +""
dl_contents << content_tag(:dt, standardize_key(key))
dl_contents << if standard_type?(value)
content_tag(:dd, value.to_s.capitalize)
Expand Down

0 comments on commit 47e135e

Please sign in to comment.