Sha256: e30e8624f885a9706c80fb535871e10ab441b2609aaa9afa4764e9f41f996795

Contents?: true

Size: 472 Bytes

Versions: 4

Compression:

Stored size: 472 Bytes

Contents

module Rafters::ComponentContext
  extend ActiveSupport::Concern

  included do
    helper_method :render_component
  end

  def render_component(name, settings = {}, template_name = nil)
    component_klass = "#{name}_component".classify.constantize
    component = component_klass.new(settings)
    component_renderer.render(component, template_name)
  end

  private

  def component_renderer
    @_component_renderer ||= Rafters::ComponentRenderer.new(self)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rafters-0.0.4 lib/rafters/component_context.rb
rafters-0.0.3 lib/rafters/component_context.rb
rafters-0.0.2 lib/rafters/component_context.rb
rafters-0.0.1 lib/rafters/component_context.rb