Parent
Methods
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
AbstractTemplate
An AbstractTemplate is a subclass of Abstract. It is used as the base class for general purpose template formats which can be used to render any other type of format.
Public Instance Methods
method_missing(sym, *args, &yld)
click to toggle source
ERB templates can be any type.
# File lib/malt/formats/abstract_template.rb, line 30
30: def method_missing(sym, *args, &yld)
31: if Malt::Format.registry.key?(sym) # TODO: Malt.machine.format?
32: return render(sym, *args, &yld).to_s
33: elsif md = /^to_/.match(sym.to_s)
34: type = md.post_match.to_sym
35: if Malt::Format.registry.key?(type) # TODO: Malt.machine.format?
36: return to(type, *args, &yld)
37: end
38: end
39: super(sym, *args, &yld)
40: end
render(*type_and_data, &yld)
click to toggle source
# File lib/malt/formats/abstract_template.rb, line 21
21: def render(*type_and_data, &yld)
22: type, data = parse_type_and_data(type_and_data)
23: opts = options.merge(:format=>type, :text=>text, :file=>file, :data=>data)
24: render_engine.render(opts, &yld)
25: #opts = options.merge(:format=>type, :text=>text, :file=>file, :data=>data, :engine=>engine)
26: #Malt.render(opts, &yld)
27: end
to(type, data=nil, &yld)
click to toggle source
# File lib/malt/formats/abstract_template.rb, line 12
12: def to(type, data=nil, &yld)
13: new_class = Malt::Format.registry[type.to_sym] # TODO: Malt.machine.format?
14: new_text = render(type, data, &yld)
15: new_file = refile(type)
16: new_options = options.merge(:text=>new_text, :file=>new_file, :type=>type)
17: new_class.new(new_options)
18: end
Disabled; run with --debug to generate this.