class Rack::Component::Renderer

Compile a Tilt template, which a component will render

Constants

DEFAULT_TILT_OPTIONS
FORMATS
OptionParser

Public Class Methods

new(options = {}) click to toggle source
# File lib/rack/component/renderer.rb, line 8
def initialize(options = {})
  require 'tilt'
  engine, template, @config = OptionParser.call(options)
  require 'erubi' if engine == 'erb' && @config[:escape_html]
  @template = Tilt[engine].new(@config) { template }
end

Public Instance Methods

call(scope, &child) click to toggle source
# File lib/rack/component/renderer.rb, line 15
def call(scope, &child)
  @template.render(scope, &child)
end