Class: ActionView::StreamingBuffer
- Defined in:
- actionview/lib/action_view/buffers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #<<(value) ⇒ Object (also: #concat, #append=)
- #html_safe ⇒ Object
- #html_safe? ⇒ Boolean
-
#initialize(block) ⇒ StreamingBuffer
constructor
A new instance of StreamingBuffer.
- #safe_concat(value) ⇒ Object (also: #safe_append=)
Constructor Details
#initialize(block) ⇒ StreamingBuffer
Returns a new instance of StreamingBuffer.
42 43 44 |
# File 'actionview/lib/action_view/buffers.rb', line 42 def initialize(block) @block = block end |
Instance Method Details
#<<(value) ⇒ Object Also known as: concat, append=
46 47 48 49 50 |
# File 'actionview/lib/action_view/buffers.rb', line 46 def <<(value) value = value.to_s value = ERB::Util.h(value) unless value.html_safe? @block.call(value) end |
#html_safe ⇒ Object
63 64 65 |
# File 'actionview/lib/action_view/buffers.rb', line 63 def html_safe self end |
#html_safe? ⇒ Boolean
59 60 61 |
# File 'actionview/lib/action_view/buffers.rb', line 59 def html_safe? true end |
#safe_concat(value) ⇒ Object Also known as: safe_append=
54 55 56 |
# File 'actionview/lib/action_view/buffers.rb', line 54 def safe_concat(value) @block.call(value.to_s) end |