Malt  Malt::Format::Erb

[Validate]
Generated with RDazzle Newfish 1.4.0

Erb

Public Instance Methods

html(data=nil, &yld) click to toggle source

Technically method_missing will pick this up, but since it is likely to be the most commonly used, adding the method directly will provide a small speed boost.

    # File lib/malt/formats/erb.rb, line 33
33:     def html(data=nil, &yld)
34:       render(:html, data, &yld)
35:     end
precompile(*) click to toggle source
rb(*) click to toggle source

TODO: Lookup engine from engine registry.

    # File lib/malt/formats/erb.rb, line 14
14:     def rb(*)
15:       render_engine.compile(:text=>text, :file=>file)
16:     end
to_html(data=nil, &yld) click to toggle source

Technically method_missing will pick this up, but since it is likely to be the most commonly used, adding the method directly will provide a small speed boost.

    # File lib/malt/formats/erb.rb, line 40
40:     def to_html(data=nil, &yld)
41:       new_text    = render(:html, data, &yld)
42:       new_file    = refile(:html)
43:       new_options = options.merge(:text=>new_text, :file=>new_file, :type=>:html)
44:       HTML.new(new_options)
45:     end
to_rb(*) click to toggle source

Erb templates can be “pre-compiled” into Ruby templates.

    # File lib/malt/formats/erb.rb, line 19
19:     def to_rb(*)
20:       text = rb
21:       Ruby.new(:text=>text, :file=>refile(:rb))
22:     end
Also aliased as: to_ruby, precompile
to_ruby(*) click to toggle source

Private Instance Methods

render_engine() click to toggle source
    # File lib/malt/formats/erb.rb, line 89
89:     def render_engine
90:       @render_engine ||= (
91:         case engine
92:         when :erubis
93:           Malt::Engine::Erubis.new(options)
94:         else
95:           Malt::Engine::Erb.new(options)
96:         end
97:       )
98:     end

Disabled; run with --debug to generate this.