Class: Lilu::View

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

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ View

Returns a new instance of View.



4
5
6
# File 'lib/lilu_view.rb', line 4

def initialize(view)
  @view = view
end

Instance Method Details

#render(template, local_assigns = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/lilu_view.rb', line 7

def render(template, local_assigns = {})
  lilu_file_path = local_assigns[:lilu_file_path]
  local_assigns.delete :lilu_file_path
  @view.instance_eval do
    local_assigns.merge!("content_for_layout" => @content_for_layout,"controller" => @controller,"___view" => self)
    Lilu::Renderer.new(template,IO.read(lilu_file_path.gsub(/#{File.extname(lilu_file_path)}$/,'.html')),@assigns.merge(local_assigns)).apply
  end
end