Class: Haml::Plugin

Inherits:
Object
  • Object
show all
Includes:
Util.av_template_class(:Handlers)::Compilable
Defined in:
lib/haml/template/plugin.rb

Instance Method Summary collapse

Instance Method Details

#cache_fragment(block, name = {}, options = nil)



32
33
34
35
36
# File 'lib/haml/template/plugin.rb', line 32

def cache_fragment(block, name = {}, options = nil)
  @view.fragment_for(block, name, options) do
    eval("_hamlout.buffer", block.binding)
  end
end

#compile(template)



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/haml/template/plugin.rb', line 16

def compile(template)
  options = Haml::Template.options.dup

  # template is a template object in Rails >=2.1.0,
  # a source string previously
  if template.respond_to? :source
    # Template has a generic identifier in Rails >=3.0.0
    options[:filename] = template.respond_to?(:identifier) ? template.identifier : template.filename
    source = template.source
  else
    source = template
  end

  Haml::Engine.new(source, options).send(:precompiled_with_ambles, [])
end

#handles_encoding?Boolean

Returns:

  • (Boolean)


14
# File 'lib/haml/template/plugin.rb', line 14

def handles_encoding?; true; end