aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/buffers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view/buffers.rb')
-rw-r--r--actionview/lib/action_view/buffers.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionview/lib/action_view/buffers.rb b/actionview/lib/action_view/buffers.rb
index 2a378fdc3c..18eaee5d79 100644
--- a/actionview/lib/action_view/buffers.rb
+++ b/actionview/lib/action_view/buffers.rb
@@ -3,6 +3,21 @@
require "active_support/core_ext/string/output_safety"
module ActionView
+ # Used as a buffer for views
+ #
+ # The main difference between this and ActiveSupport::SafeBuffer
+ # is for the methods `<<` and `safe_expr_append=` the inputs are
+ # checked for nil before they are assigned and `to_s` is called on
+ # the input. For example:
+ #
+ # obuf = ActionView::OutputBuffer.new "hello"
+ # obuf << 5
+ # puts obuf # => "hello5"
+ #
+ # sbuf = ActiveSupport::SafeBuffer.new "hello"
+ # sbuf << 5
+ # puts sbuf # => "hello\u0005"
+ #
class OutputBuffer < ActiveSupport::SafeBuffer #:nodoc:
def initialize(*)
super