Class: Bridgetown::ERBView

Inherits:
RubyTemplateView show all
Includes:
ERBCapture
Defined in:
lib/bridgetown-core/converters/erb_templates.rb

Direct Known Subclasses

SerbeaView

Instance Attribute Summary

Attributes inherited from RubyTemplateView

#content, #layout, #paginator, #resource, #site

Instance Method Summary collapse

Methods included from ERBCapture

#capture

Methods inherited from RubyTemplateView

#collections, #data, #helpers, #initialize, #inspect, #liquid_render, #method_missing, #render, #respond_to_missing?, #site_drop

Constructor Details

This class inherits a constructor from Bridgetown::RubyTemplateView

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bridgetown::RubyTemplateView

Instance Method Details

#_render_partial(partial_name, options) ⇒ Object



90
91
92
93
94
95
96
97
98
99
# File 'lib/bridgetown-core/converters/erb_templates.rb', line 90

def _render_partial(partial_name, options)
  partial_path = _partial_path(partial_name, "erb")
  tmpl = site.tmp_cache["partial-tmpl:#{partial_path}"] ||= Tilt::ErubiTemplate.new(
    partial_path,
    outvar: "@_erbout",
    bufval: "Bridgetown::OutputBuffer.new",
    engine_class: ERBEngine
  )
  tmpl.render(self, options)
end

#h(input) ⇒ Object



78
79
80
# File 'lib/bridgetown-core/converters/erb_templates.rb', line 78

def h(input)
  Erubi.h(input)
end

#partial(partial_name = nil, **options, &block) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/bridgetown-core/converters/erb_templates.rb', line 82

def partial(partial_name = nil, **options, &block)
  partial_name = options[:template] if partial_name.nil? && options[:template]
  options.merge!(options[:locals]) if options[:locals]
  options[:content] = capture(&block) if block

  _render_partial partial_name, options
end