Class: Scribble::Methods::Layout
- Inherits:
-
Block
- Object
- Scribble::Method
- Block
- Scribble::Methods::Layout
- Defined in:
- lib/scribble/methods/layout.rb
Instance Method Summary collapse
Methods inherited from Block
Methods included from Support::Context
#converter, #evaluate, #format, included, #nodes, #registers, #render, #render_without_conversion, #require_conversion?, #resolve_variable, #set_variable, #template, #variables
Methods inherited from Scribble::Method
block?, eql?, implement, #initialize, insert, max_arity, min_arity, register, setup, split?
Constructor Details
This class inherits a constructor from Scribble::Method
Instance Method Details
#content ⇒ Object
16 17 18 |
# File 'lib/scribble/methods/layout.rb', line 16 def content render context: @context end |
#layout(name, object = nil) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/scribble/methods/layout.rb', line 6 def layout name, object = nil template.load(name, self).tap do |partial_context| raise Errors::NotFound.new("Layout partial '#{name}' not found #{@call.line_and_column}") if partial_context.nil? partial_context.set_variable name.to_sym, object if object @render_format = partial_context.format end.render end |
#render_format ⇒ Object
20 21 22 |
# File 'lib/scribble/methods/layout.rb', line 20 def render_format @render_format || super end |