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:14:47 -0800 |
commit | 621d2199599e9a3154ce6f6e81385bf574030f15 (patch) | |
tree | bf00e0970808b15ad79cf870e0192bf26664e3b4 /activesupport/lib/active_support | |
parent | 7b73913701ff41981d166ca457e41690aac3bce3 (diff) | |
download | rails-621d2199599e9a3154ce6f6e81385bf574030f15.tar.gz rails-621d2199599e9a3154ce6f6e81385bf574030f15.tar.bz2 rails-621d2199599e9a3154ce6f6e81385bf574030f15.zip |
add AS::SafeBuffer#clone_empty
Diffstat (limited to 'activesupport/lib/active_support')
-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 c6d861d124..5b39fd6a6a 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -119,6 +119,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) |