Class: Haml::RailsTemplate
- Inherits:
-
Object
- Object
- Haml::RailsTemplate
- Defined in:
- lib/haml/rails_template.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.options ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/haml/rails_template.rb', line 11 def @options ||= { generator: Temple::Generators::RailsOutputBuffer, use_html_safe: true, streaming: true, buffer_class: 'ActionView::OutputBuffer', disable_capture: true, } end |
.set_options(opts) ⇒ Object
21 22 23 |
# File 'lib/haml/rails_template.rb', line 21 def (opts) .update(opts) end |
Instance Method Details
#call(template, source = nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/haml/rails_template.rb', line 26 def call(template, source = nil) source ||= template.source = RailsTemplate. # https://github.com/haml/haml/blob/4.0.7/lib/haml/template/plugin.rb#L19-L20 # https://github.com/haml/haml/blob/4.0.7/lib/haml/options.rb#L228 if template.respond_to?(:type) && template.type == 'text/xml' = .merge(format: :xhtml) end if ActionView::Base.try(:annotate_rendered_view_with_filenames) && template.format == :html = .merge( preamble: "<!-- BEGIN #{template.short_identifier} -->\n", postamble: "<!-- END #{template.short_identifier} -->\n", ) end Engine.new().call(source) end |
#supports_streaming? ⇒ Boolean
46 47 48 |
# File 'lib/haml/rails_template.rb', line 46 def supports_streaming? RailsTemplate.[:streaming] end |