Class: ActionView::OutputBuffer
- Inherits:
-
ActiveSupport::SafeBuffer
- Object
- ActiveSupport::SafeBuffer
- ActionView::OutputBuffer
- Defined in:
- lib/action_view/buffers.rb
Overview
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"
Instance Method Summary collapse
- #<<(value) ⇒ Object (also: #append=)
-
#initialize ⇒ OutputBuffer
constructor
:nodoc:.
- #safe_expr_append=(val) ⇒ Object
Constructor Details
#initialize ⇒ OutputBuffer
:nodoc:
22 23 24 25 |
# File 'lib/action_view/buffers.rb', line 22 def initialize(*) super encode! end |
Instance Method Details
#<<(value) ⇒ Object Also known as: append=
27 28 29 30 |
# File 'lib/action_view/buffers.rb', line 27 def <<(value) return self if value.nil? super(value.to_s) end |
#safe_expr_append=(val) ⇒ Object
33 34 35 36 |
# File 'lib/action_view/buffers.rb', line 33 def safe_expr_append=(val) return self if val.nil? safe_concat val.to_s end |