Sha256: c42b3bcd7fc81b1fd1744dbf28e5bff4afa5e84fc80c3325a81ce588dac3dd67
Contents?: true
Size: 805 Bytes
Versions: 1
Compression:
Stored size: 805 Bytes
Contents
# frozen_string_literal: true module ::AmberComponent # Provides code which handles rendering different # template languages outside of Rails. module TemplateHandler class << self # @param context [AmberComponent::Base] # @param content [String] # @param type [Symbol, String] # @param block [Proc, nil] # @return [String] def render_from_string(context, content, type, block = nil) tilt_handler = ::Tilt[type] raise UnknownViewTypeError, <<~ERR.squish unless tilt_handler Unknown view type for `#{context.class}`! Check return value of param type in `view type: :[type]` or the view file extension. ERR tilt_handler.new { content }.render(context, &block).html_safe end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
amber_component-1.2.0 | lib/amber_component/template_handler.rb |