Class: Temple::Generators::ERB

Inherits:
Temple::Generator show all
Defined in:
lib/temple/generators/erb.rb

Overview

Implements an ERB generator.

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 Temple::Generator

#create_buffer, #on, #on_newline, #postamble, #preamble, #restore_buffer, #return_buffer, #save_buffer

Methods included from Mixins::Options

included, #initialize

Methods included from Mixins::CompiledDispatcher

#compile

Methods included from Utils

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

Instance Method Details

#call(exp) ⇒ Object



8
9
10
# File 'lib/temple/generators/erb.rb', line 8

def call(exp)
  compile(exp)
end

#on_capture(name, exp) ⇒ Object



16
17
18
# File 'lib/temple/generators/erb.rb', line 16

def on_capture(name, exp)
  on_code(super)
end

#on_code(code) ⇒ Object



28
29
30
# File 'lib/temple/generators/erb.rb', line 28

def on_code(code)
  "<% #{code} %>"
end

#on_dynamic(code) ⇒ Object



24
25
26
# File 'lib/temple/generators/erb.rb', line 24

def on_dynamic(code)
  "<%= #{code} %>"
end

#on_multi(*exp) ⇒ Object



12
13
14
# File 'lib/temple/generators/erb.rb', line 12

def on_multi(*exp)
  exp.map {|e| compile(e) }.join('')
end

#on_static(text) ⇒ Object



20
21
22
# File 'lib/temple/generators/erb.rb', line 20

def on_static(text)
  text
end