Skip to content

Commit

Permalink
Merge pull request #37303 from eregon/follow-frozen-symbol-to_s
Browse files Browse the repository at this point in the history
Use String#+@ before mutating the result of Symbol#to_s
  • Loading branch information
kamipo authored and rafaelfranca committed Sep 26, 2019
1 parent 6091b8f commit ed81031
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/ordered_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def [](key)
end

def method_missing(name, *args)
name_string = name.to_s
name_string = +name.to_s
if name_string.chomp!("=")
self[name_string] = args.first
else
Expand Down

2 comments on commit ed81031

@eregon
Copy link
Contributor

@eregon eregon commented on ed81031 Sep 26, 2019

Choose a reason for hiding this comment

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

Since Rails 5 requires Ruby 2.2.2 or newer, we should probably use name.to_s.dup for 5-2-stable, since String#+@ was introduced in Ruby 2.3, right?
Unless Rails defines String#+@ on Ruby 2.2?
See #37303 (comment)

@eregon
Copy link
Contributor

@eregon eregon commented on ed81031 Nov 2, 2019

Choose a reason for hiding this comment

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

(fixed in fbcb47b to use name.to_s.dup)

Please sign in to comment.