Class: ActionView::StreamingBuffer
Do not use. This class is for internal use only.
Relationships & Source Files | |
Inherits: | Object |
Defined in: | actionview/lib/action_view/buffers.rb |
Class Method Summary
- .new(block) ⇒ StreamingBuffer constructor
Instance Attribute Summary
-
#append=(value)
writeonly
Alias for #<<.
- #block readonly
- #html_safe? ⇒ Boolean readonly
-
#safe_append=(value)
writeonly
Alias for #safe_concat.
Instance Method Summary
- #<<(value) (also: #concat, #append=)
- #capture
-
#concat(value)
Alias for #<<.
- #html_safe readonly
- #raw
- #safe_concat(value) (also: #safe_append=)
Constructor Details
.new(block) ⇒ StreamingBuffer
Instance Attribute Details
#append=(value) (writeonly)
Alias for #<<.
# File 'actionview/lib/action_view/buffers.rb', line 119
alias :append= :<<
#block (readonly)
[ GitHub ]# File 'actionview/lib/action_view/buffers.rb', line 147
attr_reader :block
#html_safe? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'actionview/lib/action_view/buffers.rb', line 135
def html_safe? true end
#safe_append=(value) (writeonly)
Alias for #safe_concat.
# File 'actionview/lib/action_view/buffers.rb', line 124
alias :safe_append= :safe_concat
Instance Method Details
#<<(value) Also known as: #concat, #append=
[ GitHub ]# File 'actionview/lib/action_view/buffers.rb', line 113
def <<(value) value = value.to_s value = ERB::Util.h(value) unless value.html_safe? @block.call(value) end
#capture
[ GitHub ]# File 'actionview/lib/action_view/buffers.rb', line 126
def capture buffer = +"" old_block, @block = @block, ->(value) { buffer << value } yield buffer.html_safe ensure @block = old_block end
#concat(value)
Alias for #<<.
# File 'actionview/lib/action_view/buffers.rb', line 118
alias :concat :<<
#html_safe (readonly)
[ GitHub ]# File 'actionview/lib/action_view/buffers.rb', line 139
def html_safe self end
#raw
[ GitHub ]# File 'actionview/lib/action_view/buffers.rb', line 143
def raw RawStreamingBuffer.new(self) end
#safe_concat(value) Also known as: #safe_append=
[ GitHub ]# File 'actionview/lib/action_view/buffers.rb', line 121
def safe_concat(value) @block.call(value.to_s) end