aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorschneems <richard.schneeman+foo@gmail.com>2018-09-06 12:00:20 -0500
committerschneems <richard.schneeman+foo@gmail.com>2018-09-06 15:28:45 -0500
commit31cfd5e4fdd0017f101af8f2f3d6b52b6ea68c08 (patch)
tree0060defbffd6f0d35d16277dda02621882567a6f /actionview
parenta01f4d53b35cc7c2bda045a5a782fffa22390e07 (diff)
downloadrails-31cfd5e4fdd0017f101af8f2f3d6b52b6ea68c08.tar.gz
rails-31cfd5e4fdd0017f101af8f2f3d6b52b6ea68c08.tar.bz2
rails-31cfd5e4fdd0017f101af8f2f3d6b52b6ea68c08.zip
[ci skip] Doc ActionView::OutputBuffer
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/buffers.rb15
-rw-r--r--actionview/lib/action_view/helpers/capture_helper.rb5
2 files changed, 17 insertions, 3 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
diff --git a/actionview/lib/action_view/helpers/capture_helper.rb b/actionview/lib/action_view/helpers/capture_helper.rb
index 63707280a3..c87c212cc7 100644
--- a/actionview/lib/action_view/helpers/capture_helper.rb
+++ b/actionview/lib/action_view/helpers/capture_helper.rb
@@ -36,10 +36,9 @@ module ActionView
# </body>
# </html>
#
- # The output of `capture` is the rendered string. For Example:
+ # The return of capture is the string generated by the block. For Example:
#
- # puts @greeting
- # # => "Welcome to my shiny new web page! The date and time is 2018-09-06 11:09:16 -0500"
+ # @greeting # => "Welcome to my shiny new web page! The date and time is 2018-09-06 11:09:16 -0500"
#
def capture(*args)
value = nil