Class: Viu::Layout

Inherits:
Html
  • Object
show all
Defined in:
lib/viu/layout.rb

Defined Under Namespace

Classes: Renderer

Instance Attribute Summary

Attributes inherited from Html

#controller

Instance Method Summary collapse

Methods inherited from Html

#compiled_method_container, inherited, #initialize, layout, layout!, template, template!

Constructor Details

This class inherits a constructor from Viu::Html

Instance Method Details

#render_in(view_context, &block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/viu/layout.rb', line 22

def render_in(view_context, &block)
  __setup!(view_context)

  rails_version = ::Rails.gem_version

  if rails_version >= RAILS_6_1_WITH_PRERELEASES
    Renderer.new(@lookup_context, layout: nil).render(__fetch_template!, self, block).body
  elsif rails_version >= RAILS_6_0
    Renderer.new(@lookup_context).render(self, { partial: __fetch_template!, layout: nil }, block).body
  else
    Renderer.new(@lookup_context).render(self, { partial: __fetch_template!, layout: nil }, block)
  end
end