Class: Lilu::View
- Inherits:
-
Object
- Object
- Lilu::View
- Defined in:
- lib/lilu_view.rb
Instance Method Summary collapse
-
#initialize(view) ⇒ View
constructor
A new instance of View.
- #render(template, local_assigns = {}) ⇒ Object
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 |