aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2011-09-09 01:05:07 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2011-09-09 01:05:07 +0530
commite05d4cea69919ed0a2e5832bde120b5d0f12c0ec (patch)
treefd9f132f021dc581755555ccfbb3c46bc33de590 /activesupport
parent9987f1e34d3cfb988734e8ee86d4c4fdfc0b71b1 (diff)
downloadrails-e05d4cea69919ed0a2e5832bde120b5d0f12c0ec.tar.gz
rails-e05d4cea69919ed0a2e5832bde120b5d0f12c0ec.tar.bz2
rails-e05d4cea69919ed0a2e5832bde120b5d0f12c0ec.zip
revert the changes from c60995f3 - related to marking sub,gsub as unavailable to use with safe strings
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb21
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