Class: Bridgetown::ERBView
- Inherits:
-
TemplateView
- Object
- TemplateView
- Bridgetown::ERBView
- Defined in:
- bridgetown-core/lib/bridgetown-core/converters/erb_templates.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from TemplateView
#content, #layout, #paginator, #resource, #site
Instance Method Summary collapse
Methods inherited from TemplateView
#collections, #data, #data_key?, #helpers, #initialize, input, #inspect, #liquid_render, #method_missing, new_with_data, render, #render, #respond_to_missing?, #site_drop, #template_view_classes, virtual_view
Methods included from Streamlined
Methods included from ERBCapture
Constructor Details
This class inherits a constructor from Bridgetown::TemplateView
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Bridgetown::TemplateView
Instance Method Details
#h(input) ⇒ Object
108 |
# File 'bridgetown-core/lib/bridgetown-core/converters/erb_templates.rb', line 108 def h(input) = Erubi.h(input) |
#partial(partial_name = nil, **options, &block) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'bridgetown-core/lib/bridgetown-core/converters/erb_templates.rb', line 110 def partial(partial_name = nil, **, &block) partial_name = [:template] if partial_name.nil? && [:template] partial_path = _partial_path(partial_name, self.class.extname_list.first.delete_prefix(".")) unless _partial_path_exist?(partial_path) @_call_super_method = true return super end .merge!([:locals]) if [:locals] [:content] = capture(&block) if block # The reason we have to do this funky rigamarole is because if a view superclass ends up # needing to render the the partial, we want to call the superclass' `_render_partial` # method, not the subclass'. Like, if `partial` is called for `SerbeaView`, and a `.serb` # partial can't be found, we'll kick up to `ERBView`. Then if an `.erb` partial is found, # we want `_render_partial` to be called via the `ERBView` definition, not `SerbeaView`! if @_call_super_method @_call_super_method = false method(:_render_partial).super_method.call partial_path, else _render_partial partial_path, end end |