Sha256: 1db7efc2f5522bd7506f05e297f3994d174f4fee8aedbd9d90ed15c85790a6d8
Contents?: true
Size: 648 Bytes
Versions: 1
Compression:
Stored size: 648 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) component.controller = @controller store(component) @controller.view_context.content_tag(:div, class: "component", id: component.identifier) do @controller.view_context.render(file: "/#{component.template_name}", locals: component.attributes) end end private def store(component) @controller.rendered_components ||= {} @controller.rendered_components.merge!(component.as_json) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rafters-1.0.0 | lib/rafters/component_renderer.rb |