Class: Hamlit::RailsTemplate
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.options ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/hamlit/rails_template.rb', line 12 def @options ||= { generator: Temple::Generators::RailsOutputBuffer, use_html_safe: true, streaming: true, buffer_class: 'ActionView::OutputBuffer', } end |
.set_options(opts) ⇒ Object
21 22 23 |
# File 'lib/hamlit/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 |
# File 'lib/hamlit/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 Engine.new().call(source) end |
#supports_streaming? ⇒ Boolean
39 40 41 |
# File 'lib/hamlit/rails_template.rb', line 39 def supports_streaming? RailsTemplate.[:streaming] end |