diff options
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 21 |
1 files changed, 1 insertions, 20 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 4c9609c27a..05b39b89bf 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -76,7 +76,6 @@ end module ActiveSupport #:nodoc: class SafeBuffer < String UNSAFE_STRING_METHODS = ["capitalize", "chomp", "chop", "delete", "downcase", "gsub", "lstrip", "next", "reverse", "rstrip", "slice", "squeeze", "strip", "sub", "succ", "swapcase", "tr", "tr_s", "upcase"].freeze - UNAVAILABLE_STRING_METHODS = [] alias_method :original_concat, :concat private :original_concat @@ -155,24 +154,6 @@ module ActiveSupport #:nodoc: EOT end - UNAVAILABLE_STRING_METHODS.each do |unavailable_method| - class_eval <<-EOT, __FILE__, __LINE__ - # def gsub(*args) - # raise NoMethodError, "gsub cannot be used with a safe string. You should use object.to_str.gsub" - # end - def #{unavailable_method}(*args) - raise NoMethodError, "#{unavailable_method} cannot be used with a safe string. You should use object.to_str.#{unavailable_method}" - end - - # def gsub!(*args) - # raise NoMethodError, "gsub! cannot be used with a safe string. You should use object.to_str.gsub!" - # end - def #{unavailable_method}!(*args) - raise NoMethodError, "#{unavailable_method}! cannot be used with a safe string. You should use object.to_str.#{unavailable_method}!" - end - EOT - end - protected def dirty? @@ -185,4 +166,4 @@ class String def html_safe ActiveSupport::SafeBuffer.new(self) end -end
\ No newline at end of file +end |