Class: Grass::Render::Page

Inherits:
Object
  • Object
show all
Includes:
Renderer
Defined in:
lib/grass/render/page.rb

Instance Method Summary collapse

Methods included from Renderer

#initialize, #templates

Methods included from Helpers::RenderHelper

#include_partial, #render_content, #render_partial

Instance Method Details

#renderObject



11
12
13
14
15
16
17
18
19
# File 'lib/grass/render/page.rb', line 11

def render          
  if @data[:view].nil? && !self.view.nil?
    @data[:view] = @view
    @data[:source] = @source
    @view.render @data
  else
    super
  end        
end

#viewObject



21
22
23
24
25
26
27
# File 'lib/grass/render/page.rb', line 21

def view
  @view ||= begin
    keys = ["/views/#{@source.dir}/#{@source.path}","/views/#{@source.dir}/#{Grass::Render::View::DEFAULT_VIEW}"]
    Source[keys].first
    # keys.map{|id| Source.find_by(key: Key.new(id: id))}.compact.first
  end
end