Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

concat is a hotspot (via AV#append=), so just directly define the met…

…hods
  • Loading branch information...
commit 9e4bb9991a72078a97510b01bb1010127a7a3706 1 parent 6b6eb94
@tenderlove tenderlove authored
View
10 activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -170,13 +170,15 @@ def clone_empty
self[0, 0]
end
- %w[concat prepend].each do |method_name|
- define_method method_name do |value|
- super(html_escape_interpolated_argument(value))
- end
+ def concat(value)
+ super(html_escape_interpolated_argument(value))
end
alias << concat
+ def prepend(value)
@shime
shime added a note

Why not alias :prepend :concat?

@matthewd Collaborator
matthewd added a note

Because that would do a different thing. See #14529 for some background... and me questioning whether define_method was a good idea. :trollface:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ super(html_escape_interpolated_argument(value))
+ end
+
def prepend!(value)
ActiveSupport::Deprecation.deprecation_warning "ActiveSupport::SafeBuffer#prepend!", :prepend
prepend value
Please sign in to comment.
Something went wrong with that request. Please try again.