Class: Confinement::Rendering::RenderChain

Inherits:
Object
  • Object
show all
Defined in:
lib/confinement.rb

Instance Method Summary collapse

Constructor Details

#initialize(body:, path:, renderers:, view_context:) ⇒ RenderChain

Returns a new instance of RenderChain.



617
618
619
620
621
622
# File 'lib/confinement.rb', line 617

def initialize(body:, path:, renderers:, view_context:)
  @body = body
  @path = path
  @renderers = renderers
  @view_context = view_context
end

Instance Method Details

#call(&block) ⇒ Object



624
625
626
627
628
# File 'lib/confinement.rb', line 624

def call(&block)
  @renderers.reduce(@body) do |memo, renderer|
    renderer.call(memo, @view_context, path: @path, &block)
  end
end