Class: Temple::Generators::StringBuffer

Inherits:
ArrayBuffer show all
Defined in:
lib/temple/generators/string_buffer.rb

Overview

Implements a string buffer.

_buf = ''
_buf << "static"
_buf << dynamic.to_s
_buf

Direct Known Subclasses

RailsOutputBuffer

Constant Summary

Constants included from Utils

Utils::ESCAPE_HTML, Utils::ESCAPE_HTML_PATTERN

Instance Attribute Summary

Attributes included from Mixins::Options

#options

Instance Method Summary collapse

Methods inherited from ArrayBuffer

#call

Methods inherited from Temple::Generator

#call, #on, #on_capture, #on_code, #on_multi, #on_newline, #on_static, #postamble, #preamble, #restore_buffer, #save_buffer

Methods included from Mixins::Options

included, #initialize

Methods included from Mixins::CompiledDispatcher

#call, #compile

Methods included from Utils

#empty_exp?, #escape_html, #escape_html_safe, #indent_dynamic, #unique_name

Instance Method Details

#create_bufferObject



13
14
15
# File 'lib/temple/generators/string_buffer.rb', line 13

def create_buffer
  "#{buffer} = ''.dup"
end

#on_dynamic(code) ⇒ Object



21
22
23
# File 'lib/temple/generators/string_buffer.rb', line 21

def on_dynamic(code)
  concat("(#{code}).to_s")
end

#return_bufferObject



17
18
19
# File 'lib/temple/generators/string_buffer.rb', line 17

def return_buffer
  buffer
end