diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-09-08 02:31:45 -0700 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-09-08 02:31:45 -0700 |
commit | 06b218dd957d7454d75eeac301a1853793a631f8 (patch) | |
tree | 3f1036cf3b714e4a3055ef581c13f86af95e9be0 /activesupport/lib/active_support/core_ext | |
parent | b4a6e2f8442ceda118367f9a61c38af754be1cbf (diff) | |
parent | c60995f31d98f2f11110516095fb35226278d960 (diff) | |
download | rails-06b218dd957d7454d75eeac301a1853793a631f8.tar.gz rails-06b218dd957d7454d75eeac301a1853793a631f8.tar.bz2 rails-06b218dd957d7454d75eeac301a1853793a631f8.zip |
Merge pull request #2931 from dmathieu/safe_gsub_doc
better method documentation on disable safe string methods
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 18 |
1 files changed, 12 insertions, 6 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 24b617578f..6e8f72e2b3 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -157,13 +157,19 @@ module ActiveSupport #:nodoc: UNAVAILABLE_STRING_METHODS.each do |unavailable_method| class_eval <<-EOT, __FILE__, __LINE__ - def #{unavailable_method}(*args) # def gsub(*args) + # def gsub(*args) + # raise NoMethodError, "gsub cannot be used with a Safe Buffer object. You should use object.to_str.gsub" + # end + def #{unavailable_method}(*args) raise NoMethodError, "#{unavailable_method} cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}" - end # end - - def #{unavailable_method}!(*args) # def gsub!(*args) - raise NoMethodError, "#{unavailable_method} cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}" - end # end + end + + # def gsub!(*args) + # raise NoMethodError, "gsub! cannot be used with a Safe Buffer object. You should use object.to_str.gsub!" + # end + def #{unavailable_method}!(*args) + raise NoMethodError, "#{unavailable_method}! cannot be used with a Safe Buffer object. You should use object.to_str.#{unavailable_method}!" + end EOT end |