diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-02 22:59:40 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-02 22:59:40 -0200 |
commit | 735abe93a5590f3d6f215a645e633d9fcd8ff3b6 (patch) | |
tree | e36da145334a1ce66607373e7d63c461effd49c5 /activesupport/lib | |
parent | 46923cabe156852bac1ae99c4509ff2780eae2a1 (diff) | |
download | rails-735abe93a5590f3d6f215a645e633d9fcd8ff3b6.tar.gz rails-735abe93a5590f3d6f215a645e633d9fcd8ff3b6.tar.bz2 rails-735abe93a5590f3d6f215a645e633d9fcd8ff3b6.zip |
Avoid generating more strings while iterating to create methods
Use the already existing strings instead of creating a new one each time
just to test if it responds to the methods.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index dc033ed11b..c21650bb83 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -171,7 +171,7 @@ module ActiveSupport #:nodoc: end UNSAFE_STRING_METHODS.each do |unsafe_method| - if 'String'.respond_to?(unsafe_method) + if unsafe_method.respond_to?(unsafe_method) class_eval <<-EOT, __FILE__, __LINE__ + 1 def #{unsafe_method}(*args, &block) # def capitalize(*args, &block) to_str.#{unsafe_method}(*args, &block) # to_str.capitalize(*args, &block) |