mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[ci skip] Doc ActionView::OutputBuffer
This commit is contained in:
parent
a01f4d53b3
commit
31cfd5e4fd
2 changed files with 17 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue