Sha256: 27b79d55bd082364aee465811a28f1fa44d9bb28a2d960205e15f8d07b6df0d7

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

class Rafters::ComponentRenderer
  def initialize(controller)
    @controller = controller

    Rafters.view_paths.each do |view_path|
      @controller.prepend_view_path(view_path)
    end
  end

  def render(component, template_name = nil)
    component.controller = @controller

    template_name = (template_name || component.template_name)

    @controller.view_context.render({
      file: "/#{template_name}", 
      locals: component.attributes
    })
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rafters-0.0.5 lib/rafters/component_renderer.rb
rafters-0.0.4 lib/rafters/component_renderer.rb
rafters-0.0.3 lib/rafters/component_renderer.rb