Class: Bridgetown::ERBView
- Inherits:
-
RubyTemplateView
- Object
- RubyTemplateView
- Bridgetown::ERBView
- Defined in:
- lib/bridgetown-core/converters/erb_templates.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from RubyTemplateView
#content, #layout, #paginator, #resource, #site
Instance Method Summary collapse
- #_render_partial(partial_name, options) ⇒ Object
- #h(input) ⇒ Object
- #partial(partial_name = nil, **options, &block) ⇒ Object
Methods inherited from RubyTemplateView
#collections, #data, #data_key?, #helpers, #initialize, #inspect, #liquid_render, #method_missing, #render, #respond_to_missing?, #site_drop
Methods included from Streamlined
Methods included from ERBCapture
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
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/bridgetown-core/converters/erb_templates.rb', line 88 def _render_partial(partial_name, ) partial_path = _partial_path(partial_name, "erb") site.tmp_cache["partial-tmpl:#{partial_path}"] ||= { signal: site.config.fast_refresh ? Signalize.signal(1) : nil, } tmpl = site.tmp_cache["partial-tmpl:#{partial_path}"] tmpl.template ||= Tilt::ErubiTemplate.new( partial_path, outvar: "@_erbout", bufval: "Bridgetown::OutputBuffer.new", engine_class: ERBEngine ) tmpl.signal&.value # subscribe so resources are attached to this partial within effect tmpl.template.render(self, ) end |
#h(input) ⇒ Object
76 77 78 |
# File 'lib/bridgetown-core/converters/erb_templates.rb', line 76 def h(input) Erubi.h(input) end |
#partial(partial_name = nil, **options, &block) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/bridgetown-core/converters/erb_templates.rb', line 80 def partial(partial_name = nil, **, &block) partial_name = [:template] if partial_name.nil? && [:template] .merge!([:locals]) if [:locals] [:content] = capture(&block) if block _render_partial partial_name, end |