diff options
author | Akira Matsuda <ronnie@dio.jp> | 2012-02-13 17:54:58 +0900 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-02-20 16:02:44 -0800 |
commit | 71b95bd954edd8e8f09293044d49b34b9120279a (patch) | |
tree | 0c7e052b74acc0a81aad854dfb854715d8ee26fc /activesupport/lib | |
parent | 08b029cd245a304fd204081c1c7f2a96ce32f4c6 (diff) | |
download | rails-71b95bd954edd8e8f09293044d49b34b9120279a.tar.gz rails-71b95bd954edd8e8f09293044d49b34b9120279a.tar.bz2 rails-71b95bd954edd8e8f09293044d49b34b9120279a.zip |
add AS::SafeBuffer#clone_empty
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 6 |
1 files changed, 6 insertions, 0 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 dd780da157..20c2befc57 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -124,6 +124,12 @@ module ActiveSupport #:nodoc: @dirty = other.dirty? end + def clone_empty + new_safe_buffer = self[0, 0] + new_safe_buffer.instance_variable_set(:@dirty, @dirty) + new_safe_buffer + end + def concat(value) if dirty? || value.html_safe? super(value) |