Class: ActionView::StreamingBuffer

Inherits:
Object
  • Object
show all
Defined in:
actionview/lib/action_view/buffers.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ StreamingBuffer

Returns a new instance of StreamingBuffer.



24
25
26
# File 'actionview/lib/action_view/buffers.rb', line 24

def initialize(block)
  @block = block
end

Instance Method Details

#<<(value) ⇒ Object Also known as: concat, append=



28
29
30
31
32
# File 'actionview/lib/action_view/buffers.rb', line 28

def <<(value)
  value = value.to_s
  value = ERB::Util.h(value) unless value.html_safe?
  @block.call(value)
end

#html_safeObject



45
46
47
# File 'actionview/lib/action_view/buffers.rb', line 45

def html_safe
  self
end

#html_safe?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'actionview/lib/action_view/buffers.rb', line 41

def html_safe?
  true
end

#safe_concat(value) ⇒ Object Also known as: safe_append=



36
37
38
# File 'actionview/lib/action_view/buffers.rb', line 36

def safe_concat(value)
  @block.call(value.to_s)
end