In Files
Parent
Information
Class Index
![show/hide quicksearch [+]](../../assets/icon/find.png)
- Malt
- Malt::Engine
- Malt::Engine::Abstract
- Malt::Engine::BlueCloth
- Malt::Engine::Builder
- Malt::Engine::Erb
- Malt::Engine::Erector
- Malt::Engine::Erubis
- Malt::Engine::Haml
- Malt::Engine::Kramdown
- Malt::Engine::Less
- Malt::Engine::Liquid
- Malt::Engine::Markaby
- Malt::Engine::Mustache
- Malt::Engine::RDiscount
- Malt::Engine::RDoc
- Malt::Engine::Radius
- Malt::Engine::Radius::context;
- Malt::Engine::RagTag
- Malt::Engine::RedCloth
- Malt::Engine::Ruby
- Malt::Engine::Sass
- Malt::Engine::Tenjin
- Malt::Format
- Malt::Format::Abstract
- Malt::Format::AbstractTemplate
- Malt::Format::Builder
- Malt::Format::CSS
- Malt::Format::Erb
- Malt::Format::Erector
- Malt::Format::HTML
- Malt::Format::Haml
- Malt::Format::LESS
- Malt::Format::Latex
- Malt::Format::Liquid
- Malt::Format::Markaby
- Malt::Format::Markdown
- Malt::Format::Mustache
- Malt::Format::PDF
- Malt::Format::RBHTML
- Malt::Format::RDoc
- Malt::Format::RHTML
- Malt::Format::Radius
- Malt::Format::RagTag
- Malt::Format::Ruby
- Malt::Format::SCSS
- Malt::Format::Sass
- Malt::Format::Tenjin
- Malt::Format::Text
- Malt::Format::Textile
- Malt::Format::UnsupportedConversion
- Malt::Format::XML
- Malt::Format::YAML
- Malt::Kernel
- Malt::Machine
- Malt::Markup
- Malt::NoEngineError
- Malt::Template
- Hash
- OpenStruct
Erb
ERB template implementation.
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
ERB templates accept two options. safe sets the safe mode for rendering the template and trim is a weird string that controls a few rendering options —it can be ’%’ and/or ’>’ or ’<>’.
Public Instance Methods
compile(params={})
click to toggle source
Compile ERB template into Ruby source code.
# File lib/malt/engines/erb.rb, line 43
43: def compile(params={})
44: file = params[:file]
45: if cache?
46: @source[file] ||= intermediate(params).src
47: else
48: intermediate(params).src
49: end
50: end
intermediate(params={})
click to toggle source
Returns instance of underlying ::ERB class.
# File lib/malt/engines/erb.rb, line 53
53: def intermediate(params={})
54: text = params[:text]
55: file = params[:file]
56:
57: opts = engine_options(params)
58: safe = opts[:safe]
59: trim = opts[:trim]
60:
61: if cache?
62: @cache[file] ||= ::ERB.new(text, safe, trim)
63: else
64: ::ERB.new(text, safe, trim)
65: end
66: end
render(params={}, &yld)
click to toggle source
Render ERB template.
The params can be:
:text - text of erb document
:file - file name where text was read (or nil)
:data - data source for template interpolation
:safe -
:trim -
Returns a String.
# File lib/malt/engines/erb.rb, line 27
27: def render(params={}, &yld)
28: text = params[:text]
29: file = params[:file]
30: data = params[:data]
31:
32: data = make_binding(data, &yld)
33:
34: if settings[:precompile] == false
35: intermediate(params).result(data)
36: else
37: ruby = compile(params)
38: eval(ruby, data, file)
39: end
40: end
Disabled; run with --debug to generate this.