Module: OpenComponents::Renderer

Defined in:
lib/opencomponents/renderer.rb

Overview

Provides rendering helper methods for components.

Instance Method Summary collapse

Instance Method Details

#render_component(component, opts = {}) ⇒ Object

Public: Builds a new RenderedComponent, executes a request for it against

the configured registry, and returns the rendered component HTML.

component - The String name of the component to render. opts - A Hash of options to use when requesting the component

(default: {}).
     :params  - A Hash of parameters to send in the component request
       (optional, default: {}).
     :version - The String version of the component to request
       (optional, default: nil).
     :headers - A Hash of HTTP request headers to include in the
       component request (optional, default: {}).


16
17
18
19
20
# File 'lib/opencomponents/renderer.rb', line 16

def render_component(component, opts = {})
  OpenComponents::RenderedComponent.new(component, opts)
    .load
    .html
end