Class: Temple::Generators::StringBuffer

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

Overview

Implements a string buffer.

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

Direct Known Subclasses

RailsOutputBuffer

Instance Attribute Summary

Attributes included from Mixins::Options

#options

Instance Method Summary (collapse)

Methods inherited from Array

#postamble

Methods inherited from Temple::Generator

#call, #compile, #on_capture, #on_code, #on_multi, #on_newline, #on_static

Methods included from Mixins::Options

included, #initialize

Instance Method Details

- (Object) on_dynamic(code)



107
108
109
# File 'lib/temple/generators.rb', line 107

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

- (Object) preamble



103
104
105
# File 'lib/temple/generators.rb', line 103

def preamble
  "#{buffer} = ''"
end