| Class | Haml::Plugin |
| In: |
lib/haml/template/plugin.rb
|
| Parent: | Haml::Util.av_template_class(:Handlers)::ERB.superclass |
In Rails 3.1+, template handlers don‘t inherit from anything. In <= 3.0, they do. To avoid messy logic figuring this out, we just inherit from whatever the ERB handler does.
# File lib/haml/template/plugin.rb, line 42
42: def cache_fragment(block, name = {}, options = nil)
43: @view.fragment_for(block, name, options) do
44: eval("_hamlout.buffer", block.binding)
45: end
46: end
# File lib/haml/template/plugin.rb, line 21
21: def compile(template)
22: options = Haml::Template.options.dup
23:
24: # template is a template object in Rails >=2.1.0,
25: # a source string previously
26: if template.respond_to? :source
27: # Template has a generic identifier in Rails >=3.0.0
28: options[:filename] = template.respond_to?(:identifier) ? template.identifier : template.filename
29: source = template.source
30: else
31: source = template
32: end
33:
34: Haml::Engine.new(source, options).send(:precompiled_with_ambles, [])
35: end