Class: ActionView::StreamingBuffer

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ StreamingBuffer

Returns a new instance of StreamingBuffer.



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

def initialize(block)
  @block = block
end

Instance Method Details

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



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

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

#html_safeObject



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

def html_safe
  self
end

#html_safe?Boolean

Returns:

  • (Boolean)


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

def html_safe?
  true
end

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



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

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