Browse files

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

  • Loading branch information...
1 parent 6b6eb94 commit 9e4bb9991a72078a97510b01bb1010127a7a3706 @tenderlove tenderlove committed Jun 2, 2014
Showing with 6 additions and 4 deletions.
  1. +6 −4 activesupport/lib/active_support/core_ext/string/output_safety.rb
10 activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -170,13 +170,15 @@ def clone_empty
self[0, 0]
- %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))
alias << concat
+ def prepend(value)
shime added a line comment Jun 4, 2014

Why not alias :prepend :concat?

Ruby on Rails member
matthewd added a line comment Jun 4, 2014

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

0 comments on commit 9e4bb99

Please sign in to comment.