Sha256: f98084523f8392f7ae7d96def6af5c7b6bfcd2ea4b6969f094e97c45a4e7065b

Contents?: true

Size: 511 Bytes

Versions: 2

Compression:

Stored size: 511 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: {
      settings: component.settings,
      attributes: component.attributes
    })
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rafters-0.0.2 lib/rafters/component_renderer.rb
rafters-0.0.1 lib/rafters/component_renderer.rb