aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/safe_buffer.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@Yehuda-Katz.local>2010-01-31 19:17:42 -0800
committerYehuda Katz <wycats@Yehuda-Katz.local>2010-01-31 19:39:13 -0800
commit4cbb9db0a5ff65b0a626a5b043331abefd89e717 (patch)
treea112ce55f5521ff31abf0e4357afcc170fc0a143 /actionpack/lib/action_view/safe_buffer.rb
parent1c83fd2eff3fd174e1aba0512aa2dd8ecdadb2c7 (diff)
downloadrails-4cbb9db0a5ff65b0a626a5b043331abefd89e717.tar.gz
rails-4cbb9db0a5ff65b0a626a5b043331abefd89e717.tar.bz2
rails-4cbb9db0a5ff65b0a626a5b043331abefd89e717.zip
For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do safe_concat("</form>"), which will skip both the flag set, and the flag check. * For the first pass, I converted virtually all #html_safe!s to #html_safe, and the tests pass. A further optimization would be to try to use #safe_concat as much as possible, reducing the performance impact if we know up front that a String is safe.
Diffstat (limited to 'actionpack/lib/action_view/safe_buffer.rb')
-rw-r--r--actionpack/lib/action_view/safe_buffer.rb27
1 files changed, 0 insertions, 27 deletions
diff --git a/actionpack/lib/action_view/safe_buffer.rb b/actionpack/lib/action_view/safe_buffer.rb
deleted file mode 100644
index 6be05b9e1e..0000000000
--- a/actionpack/lib/action_view/safe_buffer.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-module ActionView #:nodoc:
- class SafeBuffer < String
- def <<(value)
- if value.html_safe?
- super(value)
- else
- super(ERB::Util.h(value))
- end
- end
-
- def concat(value)
- self << value
- end
-
- def html_safe?
- true
- end
-
- def html_safe!
- self
- end
-
- def to_s
- self
- end
- end
-end \ No newline at end of file